Bifid cipher: Difference between revisions

m
→‎{{header|Perl}}: consolidate two lists into a single array
(Added Perl)
m (→‎{{header|Perl}}: consolidate two lists into a single array)
Line 184:
 
sub encrypt ($text, %P) {
my(%I, @c1, @c2c, $encrypted);
for my($k,$v) (%P) { $I{$v} = $k }
for my ($n,$char) (indexed split '', ($text =~ s/\s//gr)) {
for my($i,$j) (split ' ', $P{$_char}) { push$c[0][$n] @c1,= $i; push$c[1][$n] @c2,= $j }
}
for my($ji,$ij) (@c2c[1]->@*, @c1c[0]->@*) { $encrypted .= $I{"$ij $ji"} }
$encrypted
}
2,392

edits