Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Rot13 (was Re: Perl Obsfucate Or Encrypter)

by cciulla (Friar)
on May 31, 2003 at 03:17 UTC ( #262025=note: print w/ replies, xml ) Need Help??


in reply to Perl Obsfucate Or Encrypter

Let's see if I got the requirements down:

  • Command line encrypter [sic]
  • Encrypt it with no problem

Given that the OP's requirements did not specify that the resultant output of the command line encrypter must be able to be interpreted, I present...

#!/usr/bin/perl use strict; use warnings; my ($final, $rot); $_ = shift; open (INFILE, $_) || die "Can't open $_: $!"; while (<INFILE>) { foreach (split //) { if (/[a-m]/i) { $rot = 13; } elsif (/[n-z]/i) { $rot = -13; } else { $rot = 0; } $final .= chr(ord() + $rot); } } close(INFILE); print $final;


Comment on Rot13 (was Re: Perl Obsfucate Or Encrypter)
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (14)
As of 2014-07-25 19:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (174 votes), past polls