sub getPeople { my ( $id, $first, $last, $age ); my $file = 'list.txt'; my @people; # using directly an array # my $cntr; -- now useless open( LIST, "< $file" ) or die "Can't open $file : $!"; while (my $row = ) { # $cntr++; -- now no longer useful my ($id, $first, $last, $age ) = split( /\s/, $row ); $id = (split( /=/, $id ))[1]; $first = (split( /=/, $first ))[1]; $last = (split( /=/, $last ))[1]; $age = (split( /=/, $age ))[1]; push @people, { 'id' => "$id", 'first' => "$first", 'last' => "$last", 'age' => "$age" }; } }