in reply to Variable into list

Your iteration through the list is wrong, while your list gets set up correctly:

print "Letters are >>@letters<<\n";

will show you what letters you got from $contact.

To iterate through the letters you got, either do:

foreach my $letter (@letters) { print "Got letter '$letter'\n"; };

or do

for my $i (0..$#letters) { print "Flag $i is $letters[$i]\n"; };

... but no mixture of the two. Either you iterate through the array or you iterate through the indices of the array.