my $arr =[1,'a',2,'b']; my $hash={1,'a',2,'b'}; print join ':',(@$arr )[1,2]; print join ':',(@$hash){1,2};