$plaintext = 'Attack at dawn!'; # formula - very simple encoding function foreach $chr (split //,$plaintext) { $ciphertext .= chr(ord($chr)+1) } print $ciphertext,"\n"; $ciphertext = ''; # non-formula # only need to do this next step once, then store hash somewhere to use when encoding foreach $letter ('A'..'Z','a'..'z',' ','!') { $shifted{$letter} = chr(ord($letter)+1) } foreach $chr(split //,$plaintext) { $ciphertext .= $shifted{$chr} } print $ciphertext, "\n";