Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Not an array reference Twitter API

by tobyink (Abbot)
on Sep 12, 2012 at 21:14 UTC ( #993316=note: print w/ replies, xml ) Need Help??


in reply to Not an array reference Twitter API

$results isn't a reference to an array, so you can't loop through it. According to the Net::Twitter documentation, it's a reference to a hash. This hash has a key "results", the value of which is an array ref, so you can loop through it.

You probably want something like...

foreach my $tweet ( @{$results->{results}} ) { printf( "%s <%s> %s\n", $tweet->{created_at}, $tweet->{from_user}, $tweet->{text}, ); }
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'


Comment on Re: Not an array reference Twitter API
Select or Download Code
Re^2: Not an array reference Twitter API
by neelakash21 (Initiate) on Sep 13, 2012 at 21:21 UTC
    Thanks for pointing it out. Your code works perfectly.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2015-07-04 10:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (59 votes), past polls