Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Chaining string ops

by davido (Cardinal)
on Aug 28, 2003 at 17:39 UTC ( [id://287462]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $str = "the boy walked the dog";
    for ( $str ) {
    ...
      s/boy/girl/;
      s/dog/Audrey II/;
    }
    
  2. or download this
    my $str = "the boy walked the dog";
    my %subs = ( "walked", "fed", "boy", "girl", "dog", "Audrey II" );
    foreach ( keys %subs ) {
      $str =~ s/$_/$subs{$_}/;
    }
    

Log In?
Username:
Password:

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

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

    No recent polls found