http://www.perlmonks.org?node_id=624284


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 :)