Public Scratchpad | Download, Select Code To D/L |
I can access a few elements through
$var->{head}->{foo}quite easy, but how do I access the looped info in
$var->{dayf}?
As in, how I loop over all three sections within 'dayf' so I can essentially output
$var->{dayf}->{day}->(first one in loop)->{part}->{icon}?
$var = { 'head' => { 'foo' => 'bar', }, 'dayf' => { 'day' => [ { 'hi' => '14', 'suns' => '9:01 PM', 'dt' => 'May 12', 'part' => { 'hmid' => '57', 'wind' => { 'gust' => 'N/A', 'd' => '103', 's' => '21', 't' => 'ESE' }, 'icon' => '39', 'p' => 'd', 'ppcp' => '30', 'bt' => 'AM Showers', 't' => 'AM Showers' }, { 'hmid' => '66', 'wind' => { 'gust' => 'N/A', 'd' => '89', 's' => '27', 't' => 'E' }, 'icon' => '11', 'p' => 'n', 'ppcp' => '60', 'bt' => 'Showers', 't' => 'Showers' } , 'd' => '0', 'sunr' => '5:26 AM', 'low' => '6', 't' => 'Thursday' }, { 'hi' => '13', 'suns' => '9:03 PM', 'dt' => 'May 13', 'part' => { 'hmid' => '60', 'wind' => { 'gust' => 'N/A', 'd' => '75', 's' => '34', 't' => 'ENE' }, 'icon' => '11', 'p' => 'd', 'ppcp' => '30', 'bt' => 'Showers/Wind', 't' => 'Few Showers / Wind' }, { 'hmid' => '77', 'wind' => { 'gust' => 'N/A', 'd' => '79', 's' => '34', 't' => 'E' }, 'icon' => '11', 'p' => 'n', 'ppcp' => '90', 'bt' => 'Light Rain', 't' => 'Light Rain / Wind' } , 'd' => '1', 'sunr' => '5:24 AM', 'low' => '7', 't' => 'Friday' }, { 'hi' => '11', 'suns' => '9:04 PM', 'dt' => 'May 14', 'part' => { 'hmid' => '80', 'wind' => { 'gust' => 'N/A', 'd' => '80', 's' => '27', 't' => 'E' }, 'icon' => '11', 'p' => 'd', 'ppcp' => '40', 'bt' => 'Showers', 't' => 'Showers' }, { 'hmid' => '83', 'wind' => { 'gust' => 'N/A', 'd' => '84', 's' => '18', 't' => 'E' }, 'icon' => '11', 'p' => 'n', 'ppcp' => '60', 'bt' => 'Light Rain', 't' => 'Light Rain' } , 'd' => '2', 'sunr' => '5:22 AM', 'low' => '6', 't' => 'Saturday' } ], 'cached' => 1115886744 }, 'cc' => { 'foo' => 'bar', }, 'loc' => { 'foo' => 'bar', } };