in reply to Caesar Shift Solution
use strict; my @code=<DATA>; my $code = join'', @code; my @alphabet = ("A".."Z"); my (%crypt); for my $try(0..26){ print "\n---- Shift of $try :\n"; for(A..Z){ my $index= ($try++)%26; $crypt{$_} = $alphabet[$index]; } for my $letter(split //,$code){ ($letter =~/\s+|\n/)? print " " :print $crypt{$letter}; } } print "\n"; __DATA__ MHILY LZA ZBHL XBPZXBL MVYABUHL HWWPBZ JSHBKPBZ JHLJBZ KPJABT HYJHUBT LZA ULBAYVU
|
|---|