Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
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 making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2015-07-06 11:22 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 (72 votes), past polls