#!/usr/bin/perl use strict; use warnings; my ($final, $rot); $_ = shift; open (INFILE, $_) || die "Can't open $_: $!"; while () { 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;