MHILY LZA ZBHL XBPZXBL MVYABUHL HWWPBZ JSHBKPBZ JHLJBZ KPJABT HYJHUBT LZA ULBAYVU #### use strict; open(CODE,"code2.txt"); my @code=; close(CODE); my @alphabet = ("A".."Z"); my (%crypt); foreach my $try_number (0 .. 26){ print STDOUT "\n---- Shift of $try_number :\n"; foreach my $letter (A .. Z){ my $index= ($try_number++)%26; $crypt{$letter} = $alphabet[$index]; } foreach my $code_line (@code){ foreach my $letter_or_space (split(//,$code_line)){ if ($letter_or_space =~/\s+/){ #Got a space print STDOUT " "; }else{ print STDOUT $crypt{$letter_or_space}; } } } } print STDOUT "\n";