On Thu, Mar 17, 2011 at 11:04, Chris Stinemetz
<cstinem...@cricketcommunications.com> wrote:
snip
> For some reason I am not getting the sorted list in my output file. Instead I 
> am getting the following:
>
> bc8) HASH(0x100d0d78) HASH(0x100d15e8) HASH(0x100d0f28) HASH(0x100d0c58) 
> HASH(0x100d1168) HASH(0x100d1678)
snip


You are getting these results because the array holds hash references.

snip
>                push @array, {
>                        cell => $cell,
>                        sect => $sect,
>                        carr => $carr,
>                        RTD  => $RTD,
>                };
snip

This line of code pushes a hash reference onto the array

snip
>                print OUTFILE "@sorted:\n";
snip

And this line prints out the whole array.  To get at the individual
elements of the hash, you must ask for them individually:

for my $hashref (@sorted) {
    print "$hashref->{cell} $hashref->{sect} $hashref->{carr}
$hashref->{RTD}\n";
}

Or all together with a hash slice:

for my $hashref (@sorted) {
    print "@{$hashref}{qw/cell sect carr RTD/}\n";
}

You may find the documentation on references helpful:

http://perldoc.perl.org/perlreftut.html
http://perldoc.perl.org/perlref.html
http://perldoc.perl.org/perldsc.html

or

perldoc perlreftut
perldoc perlref
perldoc perldsc


-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to