ARRAY(0x33b930) ARRAY(0x889eb0) ARRAY(0x8896b4) ARRAY(0x33b810) #### [ 1, 1, 1, 0, 1, 1, ], [ 1, 1, 1, 1, 0, 1, ], [ 1, 1, 0, 0, 0, 0, ], [ 0, 0, 1, 1, 1, 1, ], #### #!/usr/bin/perl # Input: A file containing vectors of 20 numbers, like: # 1,1,0,0,0,0,0,1,1,1,1,0,0,0,1,1,1,1,0,0 # 0,0,1,1,0,0,1,1,0,0,1,1,0,1,0,1,0,1,1,0 # Desired Output (see translation table below) # Odp- # kIr+ use strict; use warnings; my %translation = ( "i" => [ 1, 1, 1, 1, 1, 1, ], "I" => [ 1, 1, 0, 0, 1, 1, ], "o" => [ 1, 1, 1, 0, 1, 1, ], "u" => [ 1, 1, 1, 1, 0, 1, ], "O" => [ 1, 1, 0, 0, 0, 0, ], "p" => [ 0, 0, 1, 1, 1, 1, ], "d" => [ 0, 1, 1, 1, 1, 0, ], "k" => [ 0, 0, 1, 1, 0, 0, ], "f" => [ 0, 0, 1, 0, 1, 1, ], "s" => [ 0, 0, 1, 0, 0, 1, ], "r" => [ 0, 1, 0, 1, 0, 1, ], "/" => [ 0, 1, ], "+" => [ 1, 0, ], "*" => [ 1, 1, ], "-" => [ 0, 0, ], ); my %reverse_translation = reverse %translation; foreach my $key (keys %reverse_translation) { print STDERR $key . "\n"; # my @array = @{ $key }; # print join ",", @array; # print "\n"; }