#!c:\perl\bin\perl.exe -w use strict; use Crypt::Twofish_PP; my $crypt = Crypt::Twofish_PP->new("innatelyinsecure"); if (!($ARGV[0])) { die "Syntax: crypt.pl (-e|-d) Text"; } elsif ($ARGV[2]) { die "incorrect syntax"; } elsif (!($ARGV[0] =~ /^-/)) { die "first argument must be mode. (-e or -d)"; } else { if ($ARGV[0] =~ /^-e$/) { my $result = $crypt->encrypt($ARGV[1]); print $result; }elsif ($ARGV[0] =~ /^-d$/) { my $result = $crypt->decrypt($ARGV[1]); print $result; }else{ print "Invalid mode argument (must be -e or -d)"; } }
In reply to Good code reference by cbingel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |