Author Topic: Write a rot13 program in one line  (Read 7503 times)

0 Members and 2 Guests are viewing this topic.

Offline Ender

  • x86
  • Hero Member
  • *****
  • Posts: 2390
    • View Profile
Re: Write a rot13 program in one line
« Reply #15 on: August 17, 2006, 09:01:16 am »
Newby, this is the code:
Code: [Select]
tr/A-Za-z/N-ZA-Mn-za-m/;

Put that in a file and perl -p it. Less than 25 characters.

Offline Newby

  • Moderator
  • Hero Member
  • *****
  • Posts: 10877
  • Thrash!
    • View Profile
Re: Write a rot13 program in one line
« Reply #16 on: August 17, 2006, 09:09:37 am »
I realize what the code is. But you gave that entire line like the line itself was the solution. :P

How about this shell script for the win?

Code: [Select]
tr A-Za-z N-ZA-Mn-za-m
Quote
newby@impaler:~/Downloads/vmware-server$ perl -p -e "tr/A-Za-z/N-ZA-Mn-za-m/;"
Testing!
Grfgvat!

newby@impaler:~/Downloads/vmware-server$ tr A-Za-z N-ZA-Mn-za-m
Testing!
Grfgvat!

Mine requires less resources I wager. :)
- Newby
http://www.x86labs.org

Quote
[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

I'd bet that you're currently bloated like a water ballon on a hot summer's day.

That analogy doesn't even make sense.  Why would a water balloon be especially bloated on a hot summer's day? For your sake, I hope there wasn't too much logic testing on your LSAT. 

Offline Ender

  • x86
  • Hero Member
  • *****
  • Posts: 2390
    • View Profile
Re: Write a rot13 program in one line
« Reply #17 on: August 17, 2006, 09:19:17 am »
haha that's neat :D I didn't know there was a tr command.

I don't really care about the resources but it is less to type ^.^