##
...
my ($action, $file, $key) = @ARGV;
my $input;
{
open(my $fh, '<', $file)
or die("Can't open $file: $!\n");
binmode($fh);
local $/;
$input = <$fh>;
}
if ($action eq '-e') {
print encrypt($input, $key);
} else {
print decrypt($input, $key);
}
####
$ diff -au a.pl <( perl a.pl -d <( perl a.pl -e a.pl key ) key )
$