The equivalent print would have been print "@k{qw(A B C)}";. Remember that m/.../ is a quote-like operator. The element seperator for interpolated slices and arrays is the value of $".
#!perl -l my %k; $k{'A'} = 'Foo'; $k{'B'} = 'Bar'; $k{'C'} = 'Baz'; { # What goes for double-quotes... print "@k{qw(A B C)}"; # Foo Bar Baz local $" = ''; print "@k{qw(A B C)}"; # FooBarBaz } { # ...also goes for the regexp operators. print qr/@k{qw(A B C)}/; # Foo Bar Baz local $" = ''; print qr/@k{qw(A B C)}/; # FooBarBaz }
Update: Added qr/.../ to the example.
In reply to Re: Hash slice in regex
by ikegami
in thread Hash slice in regex
by anjiro
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |