Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Swapping names of list while keeping the contents as it is.

by philiprbrenan (Monk)
on Aug 30, 2012 at 18:32 UTC ( #990818=note: print w/ replies, xml ) Need Help??


in reply to Swapping names of list while keeping the contents as it is.

Try:

use feature ":5.14"; use warnings FATAL => qw(all); use strict; for(split /\n/, << 'END') jay 21 34 56 bob 12 39 jay 11 10 bob 14 jay 190 bob 13 END {s/jay/bob/ or s/bob/jay/; say }

Produces

bob 21 34 56
jay 12 39
bob 11 10
jay 14
bob 190
jay 13


Comment on Re: Swapping names of list while keeping the contents as it is.
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (23)
As of 2014-07-22 14:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (116 votes), past polls