SergioQ has asked for the wisdom of the Perl Monks concerning the following question:
Dear Perl Monks,
I am running into a wall when I use TMDB's
my @results = $search->find( id => 'tt0114694', source => 'imdb_id' );
The result I get back is a hash that comes back in a referenced array. in my case it's just one item returned, which is posted at the bottom. When I read the fifth key in the hash, I get an array. I am assumed that it is also an array of another hash. Obviously it is not, and there is where I am stuck.
When I use this code, I get the same array for both. If someone can tell me what I am getting wrong, I'd appreciate it so much.
foreach my $narray (@results){ print $narray->{"movie_results"}; print "\n"; my @newarray = $narray->{"movie_results"}; print $newarray[0]; print "\n";
This is my output from the original call
$VAR1 = { 'tv_season_results' => [], 'tv_results' => [], 'person_results' => [], 'tv_episode_results' => [], 'movie_results' => [ { 'adult' => bless( do{\(my $o = 0) +}, 'JSON::PP::Boolean' ), 'vote_average' => '6.8', 'original_title' => 'Tommy Boy', 'vote_count' => 635, 'id' => 11381, 'release_date' => '1995-03-31', 'overview' => 'Party animal Tommy + Callahan is a few cans short of a six-pack. But when the family busi +ness starts tanking, it\'s up to Tommy and number-cruncher Richard Ha +yden to save the day.', 'genre_ids' => [ 35 ], 'title' => 'Tommy Boy', 'video' => $VAR1->{'movie_results +'}[0]{'adult'}, 'poster_path' => '/g32WbO9nbY5ydp +ux5hIoiJkLEQi.jpg', 'original_language' => 'en', 'backdrop_path' => '/bZ4diYf7oyDV +aRYeWG42Oify2mB.jpg', 'popularity' => '13.945' } ] };
|
|---|