This text looks like JSON (http://json.org). JSON can be easily processed by JSON or JSON::XS modules.
use strict; use warnings; use Data::Dumper; use JSON; my $json_text = q{ { "InstanceStatuses": [ { "InstanceId": "i-308c0b3c", "InstanceState": { "Code": 16, "Name": "running" }, "AvailabilityZone": "us-west-2b", "SystemStatus": { "Status": "ok", "Details": [ { "Status": "passed", "Name": "reachability" } ] }, "InstanceStatus": { "Status": "ok", "Details": [ { "Status": "passed", "Name": "reachability" } ] } } ] } }; # decode JSON text my $hashref = decode_json $json_text; # dump the hashref print Dumper( $hashref ) . "\n"; # access Name print "Name: '$hashref->{InstanceStatuses}->[0]->{InstanceState}->{Nam +e}'\n";
In reply to Re: reading a text file into hash
by pme
in thread reading a text file into hash
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |