Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

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;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://262025]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (8)
As of 2017-06-24 02:13 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (556 votes). Check out past polls.