@fields_from=qw|field1 field2 field3 field4 field5 field6 field7 field8 field9 field10 field11 field12 field13|; ### is a text file with 13 field, separated by ';;' while ($tmpline = ) { chomp ($tmpline); $tmpline =~ s/\s*(\d+);;(.+);;\s*(\d+);;\s*(\d+);;\s*(\d+);;\s*(\d+);;\s*(\d+);;\s*(\d+);;\s*(\d+);;(.+?)\s*;;\s*(.*?)\s*;;\s*(\d+);;(.+)\s*/"$1", "$2", "$ 3", "$4", "$5", "$6", "$7", "$8", "$9", "$10", "$11", "$12", "$13"/; ### Pattern always match. @data_from = $tmpline; @from{@fields_from} = @data_from; #Problem is here? while (($key, $value) = each %from) { print "$key => $value\n"; }