Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Pattern Matching, left-to-right

by antirice (Priest)
on Aug 20, 2004 at 20:11 UTC ( [id://384680]=note: print w/replies, xml ) Need Help??


in reply to Pattern Matching, left-to-right

Perhaps something like...

my %map = ( F => "|", S => "^", T => "&", R => "~", E => "\\" ); $msgu =~ s/\\([FSTRE])\\/$map{$1}/g;

antirice    
The first rule of Perl club is - use Perl
The
ith rule of Perl club is - follow rule i - 1 for i > 1

Replies are listed 'Best First'.
•Re^2: Pattern Matching, left-to-right
by merlyn (Sage) on Aug 20, 2004 at 20:28 UTC

      I get AB&F^CD when I run it, which the OP says is what should happen. By his description of the task the code is also exactly what he's after. Which case do you have in mind that it fails for?

      Makeshifts last the longest.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-04-26 01:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found