Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Twitter API - Not a hash reference

by Discipulus (Canon)
on Mar 08, 2018 at 20:25 UTC ( [id://1210531]=note: print w/replies, xml ) Need Help??


in reply to Twitter API - Not a hash reference

Hello,

Just seeing docs (never twitted inmy life..) I assume $nt->lookup_users.. returns an array so you need to iterate over element or access directly one as in:

# totally untested! my @users = $nt->lookup_users; foreach my $usr (@users){ print $usr{screen_name}; #?? use Data:Dump dd method to see the structure you get back (better t +han Data::Dumper) dd $usr } # or directly first element returned print $users[0]{screen_name}; dd $users[0];

I just looked here and here

UPDATE sorry the method does not returns an array but an array ref: not big difference but different..

# totally untested! again my $users = $nt->lookup_users; foreach my $usr (@$users){ print $usr{screen_name}; #?? use Data:Dump dd method to see the structure you get back (better t +han Data::Dumper) dd $usr } # or directly first element returned print $$users[0]->{screen_name}; dd $$users[0];

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Replies are listed 'Best First'.
Re^2: Twitter API - Not a hash reference
by Anonymous Monk on Mar 08, 2018 at 20:38 UTC
    This works, thanks! And Data::Dump help me figure out how get to the latest tweet also :) Very helpful.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2024-04-23 14:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found