Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

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?

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2015-11-30 03:49 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (757 votes), past polls