Re: regexp as hash value?

2014-01-25 Thread Paul Johnson
On Sat, Jan 25, 2014 at 06:41:00PM +0100, Luca Ferrari wrote: > On Sat, Jan 25, 2014 at 4:12 PM, Paul Johnson wrote: > > > $ perl -E '$h = { a => qr/y/ }; say $_ =~ $h->{a} for qw(x y z)' > > Thanks, but then another doubt: having a look at > http://perldoc.perl.org/perlop.html#Regexp-Quote-Like

Re: regexp as hash value?

2014-01-25 Thread Luca Ferrari
On Sat, Jan 25, 2014 at 4:12 PM, Paul Johnson wrote: > $ perl -E '$h = { a => qr/y/ }; say $_ =~ $h->{a} for qw(x y z)' Thanks, but then another doubt: having a look at http://perldoc.perl.org/perlop.html#Regexp-Quote-Like-Operators I dont understand how I can use the regexp for substitution, th

Re: regexp as hash value?

2014-01-25 Thread Paul Johnson
On Sat, Jan 25, 2014 at 03:51:53PM +0100, Luca Ferrari wrote: > Hi, > I'm just wondering if it is possible to place a regexp as a value into > an hash so to use it later as something like: > > my $string =~ $hash_ref->{ $key }; > > Is it possible? Should I take into account something special? Ye

regexp as hash value?

2014-01-25 Thread Luca Ferrari
Hi, I'm just wondering if it is possible to place a regexp as a value into an hash so to use it later as something like: my $string =~ $hash_ref->{ $key }; Is it possible? Should I take into account something special? Thanks, Luca -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For a