Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Pearls (not really) of Perl programming

by hardburn (Abbot)
on Nov 24, 2004 at 17:44 UTC ( #410193=note: print w/replies, xml ) Need Help??


in reply to Pearls (not really) of Perl programming

A lovely ROT-13 encoder:

# $str contains the characters to encode my @chars = split //, $str; for (@chars) { if( $_ eq 'a' ) { $_ = 'n' } if( $_ eq 'b' ) { $_ = 'o' } if( $_ eq 'c' ) { $_ = 'p' } # And so on. I think you all see where this is going }

Hey, how about this one-liner: $str =~ tr/A-Za-z/N-ZA-Mn-za-m/;.

"There is no shame in being self-taught, only in not trying to learn in the first place." -- Atrus, Myst: The Book of D'ni.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://410193]
help
Chatterbox?
[Eily]: and this time you didn't get "but the OP only asked for a solution with sed, grep, awk, bash, tail and cat"
[choroba]: When I get that, I usually just reply "Good luck" and move on.
[marto]: I'm sure it's only going to be a matter of hours before someone adds that comment
[marto]: or closes the question because it's a almost the same as one someone else asked, years ago...
[marto]: snackoverflow gamification of editorial powers for the win :/
marto should register snarkoverflow
[marto]: nothing to see here people, go about your daily business :P

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2018-01-23 10:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (243 votes). Check out past polls.

    Notices?