Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Strange Regex Behavior

by remiah (Hermit)
on Dec 06, 2011 at 07:04 UTC ( [id://941966]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    %hash =(
      a => ($b =~ /(\d+)/ ? $1 : 0),
      b => "test b",
    );
    print "$_=#$hash{$_}#\n" for keys %hash;
    
  2. or download this
    %hash = (
      a => (($b =~ /(?<tag>\d+)/) ? $+{tag} : 0),
      b => (($b =~ /(?<tag>test)/) ? $+{tag} : 0),
    );
    print "$_=#$hash{$_}#\n" for keys %hash;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://941966]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-03-29 09:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found