open (FILE, $lfilename) or &dienice; # my $hash; # Never used. ??? # my $line; # Declared my inside the while(). ??? # my %hash; # Declared my inside the while(). ??? my @products; while ( ) { if ( /^Begin Product (.*)/i ) { my %hash; $hash{ 'name' } = $1; $hash{ 'description' } = ; $hash{ 'numberline1' } = ; $hash{ 'numberline2' } = ; my $track = ; $hash{ 'tracking' } = ( $track =~ /(Yes|No)/i ); $hash{ 'images' } = ; $hash{ 'producttext' } = ; my $line = ; # Why are you doing this, anyway? # last if ( $line =~ /End Product/ ); push @products, \%hash; }} # @products contains all of your hashes. # Lookup the one you want in it. print "$products[0]{name}"; # Where was $ref supposed to've come from? # print "", my $ref->{name}, "";