dalziel has asked for the wisdom of the Perl Monks concerning the following question:
If I say print $people[0][0]->name; it prints out the name of the first person, butmy $foaf = XML::FOAF->new(URI->new('http://glenn.typepad.com/foaf.rdf' +)); my $person = $foaf->person; my @people = $person->knows;
doesn't print out the names of all the people, it just seems to return person as itself (ie if I putforeach (@people[0) { print $_; }
inside the loop it works) I'm not sure why it needs the array of array ($people[0][0]) but I've tried it without that & it doesn't work. Am I missing something blindingly obvious here?my @pp = $_; print $pp[0][0]->name;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Looping through an array of objects
by graff (Chancellor) on Jan 19, 2004 at 02:25 UTC | |
by dalziel (Initiate) on Jan 19, 2004 at 02:44 UTC |