in reply to reading file in Hash

You can also try to use the Data::CTable module. Here's a one way you can do to get the final data structure you need. You should read more module documentation for the Data::CTable module if you need more functions to access/modify the data.
#!/usr/bin/perl use strict; use Data::Dumper; use Data::CTable; my $table = Data::CTable->new("data.txt"); $table->clean_ws(); # a bit of a clean up my $fields = $table->fieldlist_all(); my %final_hash; foreach my $col ( @$fields ) { $final_hash{$col} = $table->{$col} ; ## Get a column you know + exists } print Dumper \%final_hash;
gives the output...
$VAR1 = { '1' => [ 'a', 'b', 'c' ], '3' => [ 'x', 'y', 'z' ], '2' => [ 'p', 'q', 'r' ] };

perliff

----------------------

"with perl on my side"