Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
Perl Monk, Perl Meditation
 
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 (Abbot) 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 wandering the Monastery: (9)
As of 2014-04-19 12:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (480 votes), past polls