Writing a perl script to holding information for two genes Basically I have a perl script in which I have an array (where each element of the array references a hash) and need to be able to print the array with a dumper function. 
Thus I need to be able to split the $line on white spaces and save into variables and then construct anonymous hash and push into @genes:

#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper; # print complex data structure
my @genes; # declare the array
while(&lt;&gt;) { # this means that as long as lines come from the pipe we keep going
  my $line = $_; # a line that come from the pipe (we go line by line)
  next unless $line =~ /^\d+/; # skip lines except those reporting genes 
  &lt;split the $line on white spaces and save into variables&gt;
  &lt;anonymous hash and push into @genes&gt;
}
print Dumper(\@genes);
exit;


I don't  even know how to approach this, this is my first time perl scripting and I am really confused. Any insight would be extremely helpful.

So far I have:

my $gene = {'id' =&gt; $id, 'start' =&gt; $start, 'end' =&gt; $end, 'frame' = $frame, 'score' =&gt; $score};
my @line_split = split(' ', $line);
my $id = $line_split [0], $start = $line_split [1], $end = $line_split [2], $frame = $line_split [3], $score = $line_split [4]
Perhaps this small test script will help demonstrate some of the principles:

#!/usr/bin/env perl                                                                                                                                              

use strict;
use warnings;
use Data::Dumper;

my @arr;

# define the current line    
my $line = "foo\tbar\tbaz\n";

# remove the trailing newline character
chomp $line; 

# put the line's elements into an anonymous array
my ($a, $b, $c) = split('\t', $line);

# insert key-value pairs into anonymous hash    
my $hash = {a =&gt; $a, b =&gt; $b, c =&gt; $c};

# add the hash table to the array
push @arr, $hash;

# print the array
print Dumper \@arr;


Run this script and see what it prints out.