Eric on 20 Apr 2009 08:07:01 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Reading the output of Dumper


Ah!  Muchas Gracias for the explanation and the link.

Eric

Mark Dominus wrote:
When I invoke Dumper on a variable like this:
     my $cgi2 = new CGI;
     print "<pre>" ;
     print Dumper($cgi2) ;
     print "</pre>" ;

I get this output:

$VAR1 = bless( {
   ...
                }, 'CGI' );

So far, so good.
Now, how do I access the elements of $cgi2 ?

$cgi2 is not a hash, but a reference to a hash.

So one uses:

        print $cgi2->{'display'}[0]    # prints 10
        print $cgi2->{'charset'}       # prints 'ISO-8859-1'
push @{$cgi2->{'display'}}, 17, 23, 119; # Push onto array

I suggest that you read http://perl.plover.com/FAQs/references.html ,
"Understand References Today", which has a short symmary of reference
syntax.
-
**Majordomo list services provided by PANIX <URL:http://www.panix.com>**
**To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**


--
#  Eric Lucas
#
#                "Oh, I have slipped the surly bond of earth
#                 And danced the skies on laughter-silvered wings...
#                                        -- John Gillespie Magee Jr
-
**Majordomo list services provided by PANIX <URL:http://www.panix.com>**
**To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**