Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
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 examining the Monastery: (5)
As of 2015-07-04 22:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls