Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: list of lists?

by BillKSmith (Monsignor)
on Jul 29, 2021 at 10:59 UTC ( #11135474=note: print w/replies, xml ) Need Help??


in reply to list of lists?

I believe that this is what you are trying to do. Note the square brackets (Making References)to create array references and the syntax @$tuple (Using References) to dereference them.
use strict; use warnings; my @sites=( ["50049", "city1", "url1"], ["52556", "city2", "url2"], ["50219", "city3", "url3"] ); foreach my $tuple (@sites) { my ( $zip, $name, $url ) = @$tuple; ...; }

Update: Added Links, corrected typo

Bill

Replies are listed 'Best First'.
Re^2: list of lists?
by guthrie (Novice) on Jul 29, 2021 at 11:54 UTC
    Thank you very much (everyone), this is just what I wanted - I couldn't figure out the "@$tuple" syntax.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2021-11-30 12:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?