while (($key,$value) = each( $ref->{photos}->{photo} )) { print $key . "\n"; }