Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: help required for regexp

by Eliya (Vicar)
on Dec 07, 2011 at 09:15 UTC ( #942186=note: print w/replies, xml ) Need Help??


in reply to help required for regexp

What is %labels?  Also, your declaration of %Hidlabels should use parentheses, not curlies.  As for the regex, you're matching on f(\d+), which only occurs once in the string...

This works for me:

my $str = "f3333_4444_2222"; my %Hidlabels = ( 3333=>1, 4444=>2, 2222=>3 ); $str =~ s/(\d+)/$Hidlabels{$1}/g;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://942186]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2016-12-08 00:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (133 votes). Check out past polls.