OK, I'm playing with WWW::Mechanize at the moment and it's thrown up what is for me an interesting question, and a good chance to learn about references
TO quote WWW::Mechanize one of the pieces of information that can be retrieved is a reference to an array containing an array reference for every <A> and <FRAME> tag and that for each <A> tag, element[0] contains the text of the href and element[1] contains the text enclosed by the <A> tag
Through reading some of the tutorials and various chunks of perl books, I've come up with the following code which will let me view all of (say) the element[0]'s:
foreach (@{$w->{links}}) { print $$_[0]."\n"; }
Now what I'd really like is to generate an array containing all of the element[0]'s which I can obviously do using the above loop and pushing onto an array - but is there some easy way through referencing that would let me do it without the loop?
In reply to References and arrays by sch
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |