my @records; while () { # Write a parse_record subroutine to return the variables you want my ($NUM, $SEC, $LONG, $LAT) = parse_record($_); # Stick your variables into an array for later use push @records, [ $NUM, $SEC, $LONG, $LAT ]; }