Mark Dominus on 20 Apr 2009 07:57:16 -0700


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

Re: Reading the output of Dumper


> 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**