in reply to Array reference of hash references

You didn't show where you called Dumper, and you didn't show what variable you are dumping. If you called it outside the while loop, you likely have a problem with variable scoping:
use warnings; #use strict; use Data::Dumper; while (<DATA>) { @off = split( /' '/, $_ ); %find = ( "start" => $off[0], "stop" => $off[1] ); my $hash_ref = \%find; my @official = []; push @official, $hash_ref; print Dumper(\@official); } __DATA__ 1234 2345 1234 2345 3345 4456
prints...
$VAR1 = [ [], { 'stop' => undef, 'start' => '1234 2345 ' } ]; $VAR1 = [ [], { 'stop' => undef, 'start' => '1234 2345 ' } ]; $VAR1 = [ [], { 'stop' => undef, 'start' => '3345 4456 ' } ];

Replies are listed 'Best First'.
Re^2: Array reference of hash references
by PrincePerl (Novice) on Oct 25, 2011 at 22:58 UTC

    i see! thanks, i was using dumper outside of the scope

    I wanted "start" to have the first number and "start" and it looks like its undefined.. Sighs

    why would it be undefined? I appreciate all the help you can give.

      I wanted "start" to have the first number and "start" and it looks like its undefined.. Sighs why would it be undefined?
      Because you are trying to split on single quotes surrounding a single space, but you have no single quotes in your data. Just use this:
      while (<DATA>) { my @off = split;

        Thanks a lot!! I really appreciate it. I guess its all a learning process for me! thanks

        it works fine now. i just wonder why it has "stop" first instead of "start".