Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: help required for regexp

by TJPride (Pilgrim)
on Dec 07, 2011 at 11:23 UTC ( #942218=note: print w/ replies, xml ) Need Help??


in reply to help required for regexp

Nobody seems to have posted a complete solution that actually works.

use strict; use warnings; my %Hidlabels = ( '3333' => 1, '4444' => 2, '2222' => 3 ); my $str = 'f3333_4444_2222'; $str =~ s/f(\d+)/$Hidlabels{$1}/g; print $str;


Comment on Re: help required for regexp
Download Code
Re^2: help required for regexp
by choroba (Canon) on Dec 07, 2011 at 11:27 UTC
    Nobody seems to have posted a complete solution that actually works.
    Neither did you.
    Update: Eliya's solution seems to work.
      Odd, I could have sworn I read all the posts on the way by. If not, then I apologize for posting essentially a duplicate solution. However, mine does in fact work if you run it, so you're wrong on that.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2015-07-01 22:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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









    Results (24 votes), past polls