Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Please tell me the meaning of this code.

by cLive ;-) (Parson)
on Jul 01, 2007 at 09:34 UTC ( #624284=note: print w/ replies, xml ) Need Help??


in reply to Please tell me the meaning of this code.

Change the 5th occurrence of whoever/whomever in $_ to whosoever/whomsoever. Here's a little more detail in a slight rewrite:

my $count=0; $_ =~ s/ ((whom?)ever) # whom? is in $2, whom?ever is in $1 / if ( ++$count == 5 ) # for the fifth match { "${2}soever"; # set to whom?soever } else { $1; # leave it as it is } /igex; # case (i)nsensitive, (g)lobal match, (e)xecute replace +string. # (x) ignore whitespace (added for this code example)
ps - I hope your tutor reads Perlmonks :)


Comment on Re: Please tell me the meaning of this code.
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (11)
As of 2015-07-01 21:59 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