Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Question about WWW::Mechanize::Link string interpolation

by sk (Curate)
on Oct 13, 2005 at 05:43 UTC ( #499766=note: print w/ replies, xml ) Need Help??


in reply to Question about WWW::Mechanize::Link string interpolation

Double quoted strings do not interpolate methods. It just interpolate scalars and arrays. So when Perl sees  "$scalar->something()" it evaluates $scalar first, that's why you get the reference instead of the URL. In your case ->url() is treated as literal string and prints it as is.

A simple example -

#!/usr/bin/perl use strict; use warnings; my $sub_ref = \&hi; print $sub_ref->(); print "$sub_ref->()", $/; sub hi { return "hi\n"; } __END__ hi CODE(0x8ad0834)->()


Comment on Re: Question about WWW::Mechanize::Link string interpolation
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2014-09-16 05:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (156 votes), past polls