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

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;

Comment on Re: help required for regexp
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (19)
As of 2015-07-02 10:17 GMT
Find Nodes?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...

    Results (33 votes), past polls