in reply to Getting data out of hash

Try:

print @{$results{$value}{August}{fullTimeEducation}};
Not familiar with the particular module that you're using, but I'm pretty sure that you're trying to output something that's an array-ref. Putting that result in @{} will force it back into a list context, so that when it's 'stringified' it will print out each element.

If the elements of this array are further refs, you'll see more "ARRAY(0xDEADBEEF)" "HASH(0xDEADBEEF)" outputs, so you'll have to think about writting some kind of formatting routine.

Replies are listed 'Best First'.
Re: Re: Getting data out of hash
by !1 (Hermit) on Nov 17, 2003 at 15:26 UTC
    Putting that result in @{} will force it back into a list context

    The @{} dereferences the reference to an array regardless of context. Also, if it was list context then shouldn't @{} return the last element of the array in scalar context? Observe:

    #!/usr/bin/perl -wl use strict; sub list { return qw(a b c); # real list } my $a_ref = [qw(a b c)]; $, = $"; print "list", @{$a_ref}; print "list", list(); print "scalar " . @{$a_ref}; print "scalar " . list(); __END__ list a b c list a b c scalar 3 scalar c

    An arrayref dereferences to an array, not a list. Sure, they're similar but they don't behave the same.