in reply to list of lists?
G'day guthrie,
As an alternative, consider an HoH (Hash of Hashes) instead of an AoA (Array of Arrays). If you need to add even more information at some later point, this may be a more flexible solution. Here's a quick-and-dirty example:
#!/usr/bin/env perl use strict; use warnings; my %site_info = ( 50049 => { city => 'city1', url => 'url1', }, 50219 => { city => 'city2', url => 'url2', }, ); my $fmt = "ZIP: %s\n\tCity: %s\n\tURL: %s\n"; for my $zip (keys %site_info) { printf $fmt, $zip, @{$site_info{$zip}}{qw{city url}}; }
Output:
ZIP: 50219 City: city2 URL: url2 ZIP: 50049 City: city1 URL: url1
— Ken
|
|---|