Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: help required for regexp

by Eliya (Vicar)
on Dec 07, 2011 at 09:15 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://942186]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2024-04-23 06:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found