ansh batra has asked for the wisdom of the Perl Monks concerning the following question:

hi monks
i have a array ref . how can i print the value at that address.
i am getting this
ARRAY(0xbb99fd8)

Replies are listed 'Best First'.
Re: how to print value at reference?
by ikegami (Patriarch) on Dec 12, 2011 at 07:49 UTC
Re: how to print value at reference?
by Anonymous Monk on Dec 12, 2011 at 07:06 UTC
Re: how to print value at reference?
by Nikhil Jain (Monk) on Dec 12, 2011 at 06:31 UTC
    It's a array ref not hash ref, if you get something like HASH(0xbb99fdx), then it's a hash ref. To get the value from the array ref, you need to dereference it, example like
    my $test = [ "Hello", "PM" ]; #print $test, you will get array ref @array_deref = @{$test}; #dereferencing the array ref print"@array_deref\n";
Re: how to print value at reference?
by GrandFather (Saint) on Dec 12, 2011 at 06:23 UTC

    You'll find the answer on line 42 of the documentation. If you show me some sample code that demonstrates the problem I might feel inclined to help a little more.

    True laziness is hard work
Re: how to print value at reference?
by ricDeez (Scribe) on Dec 12, 2011 at 16:02 UTC

    To help you understand the underlying data structures that you have created, use the Data::Dumper module. An example follows, using a $test variable proposed elsewhere in this thread:

    use strict; use warnings; use Data::Dumper; my $test = [ "Hello", "PM" ]; print (( Data::Dumper->new([ \$test ], [qw( *test )]))->Dump); # or # my $dd = Data::Dumper->new([ \$test ], [qw( *test )]); # print $dd->Dump;