Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^4: xml simple not a hash reference

by Noverast (Initiate)
on Dec 29, 2010 at 07:40 UTC ( #879570=note: print w/replies, xml ) Need Help??


in reply to Re^3: xml simple not a hash reference
in thread xml simple not a hash reference

Thanks, I am almost there. I am using the following code:

my $type = ref( $e->{mealplans}->{mealplan} ); if ($type eq "ARRAY") { $mealplans=$e->{mealtypes}->{mealtype}; for my $mealtype ( @{$e->{mealtypes}->{mealtype}} ) { $rateid = $mealtype->{rateid}; print "$mealtype"; } }

It prints out: HASH(0x27acfbc)HASH(0x27acfcc) How do I get the Array readable?

Replies are listed 'Best First'.
Re^5: xml simple not a hash reference
by morgon (Priest) on Dec 29, 2010 at 07:51 UTC
    It prints out: HASH(0x27acfbc)
    This indicates that your $mealtype variable does not hold a scalar or array, but a reference to a hash.

    The easiest way to print that is probably to use Data::Dumper:

    use Data::Dumper; print Dumper($mealtype);
      To quote perldata
      Perl has three built-in data types: scalars, arrays of scalars, and associative arrays of scalars, known as "hashes". A scalar is a single string (of any size, limited only by the available memory), number, or a reference to something (which will be discussed in perlref).

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://879570]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2023-06-10 08:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you go to conferences?






    Results (37 votes). Check out past polls.

    Notices?