Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Open and parsing a file with array of hashes!?

by hbm (Hermit)
on Aug 16, 2012 at 15:08 UTC ( #987795=note: print w/ replies, xml ) Need Help??


in reply to Open and parsing a file with array of hashes!?

Another option?

use strict; use warnings; my $weather = do "weather.txt"; print $weather->[0]->{xml_api_reply}->{weather}->{forecast_information +}->{city}->{-data},$/; # prints Miami, FL


Comment on Re: Open and parsing a file with array of hashes!?
Download Code
Re^2: Open and parsing a file with array of hashes!?
by Anonymous Monk on Aug 16, 2012 at 15:25 UTC
    Could it be in a loop in get all the city names?
      use strict; use warnings; my $weather = do "weather.txt"; print $_->{xml_api_reply}->{weather}->{forecast_information}->{city}-> +{-data},$/ for @$weather;

      Prints:

      Miami, FL Boston, MA

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2014-12-26 14:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (171 votes), past polls