Thus we don't have to worry about being sure the values of the hash are all present and what-not. Specify an empty list on the right-hand-side to set the values all to undef, and just use exists to see if it's there. It's also slightly faster (but not much).@a{qw{ a b c }} = (); # not (1)x3 or whatever foreach (qw{ a b c }) { print "$_\n" if exists $a{$_}; }
In reply to Re: Possible pitfall with Slices
by Fastolfe
in thread Possible pitfall with Slices
by fundflow
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |