cajun has asked for the wisdom of the Perl Monks concerning the following question:
WWW::Mechanize clearly states:
$mech->links
Lists all the links on the current page. Each link is a WWW::Mechanize::Link object. In list context, returns a list of all links. In scalar context, returns an array reference of all links.
Ok, great.
@links = $mech->links; foreach (@links){ print $_->url(), "\n"; }
Fine, this prints out the URLs as I would expect it to. No problem.
http://www.xxx.com
http://www.yyy.com
http://www.zzz.com
This however prints:@links = $mech->links; foreach (@links){ print "Would get --> $_->url()\n"; }
What I do not understand is what is the difference?
Thanks for any enlightenment,
Mike
Update: Thanks ikegami and sk for the very clear answers and explanations as well as the working alternatives. Very much appreciated.
2005-10-13 Retitled by g0n, as per Monastery guidelines
Original title: 'Context'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Question about WWW::Mechanize::Link string interpolation
by ikegami (Patriarch) on Oct 13, 2005 at 05:41 UTC | |
|
Re: Question about WWW::Mechanize::Link string interpolation
by sk (Curate) on Oct 13, 2005 at 05:43 UTC |