PEOPLE CARS CAR_COLORS AGES John Volks avocado 26 Mira Fiat (yuck) black 25 Mom Twingo cherry 50 #### my @columns = OpenFlatFile('TEST') or warn('file missing, unaccessible or empty'); foreach (keys %{$columns[0]}) { # might as well have said 'keys %PEOPLE' print "$PEOPLE{$_} drives a $CAR_COLORS{$_} $CARS{$_} and is $AGES{$_} years old.\n" } sub OpenFlatFile { my ($datfile) = $_[0]; my $delimiter = "\t"; my $val; open(FILE,$datfile) or return(0); my @tmp = ; close(FILE); my $head = shift(@tmp); chop $head; @{$datfile} = split($delimiter,$head); foreach (@tmp) { my $x = 0; chop; my @line = split($delimiter,$_); foreach $val (@{$datfile}) { if ((! defined ${$val}{$line[0]}) && ($line[$x] ne '')) { ${$val}{$line[0]} = $line[$x]; } ++$x; } } return(@{$datfile}); }