$hash{ リスト } と書けないので
配列の場合は $array[リスト] と添字を指定して新たなリストが作れる。
$ perl -e '@x=(0..5);@y=@x[2,1,4];print @y' 214
ハッシュの場合も $hash{リスト} とキーを指定して新たなハッシュを作るか、そのキーの値のリストができるかすると嬉しい。
[takeyuki@sunya ~]$ perl -e '%x=map{$_=>$_x2}(0..5);@y=%x{2,1,4};print @y' syntax error at -e line 1, near "%x{" Execution of -e aborted due to compilation errors.
use strict; use warnings; my %x = map { $_ => $_ x 2 } qw/this is a test/; #my ($this, $test, $that) = $x{qw/this test that/}; my ($this, $test, $that) = map { $x{$_} || q{} } qw/this test that/; print "$this,$test,$that\n";