Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

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

by sk (Curate)
on Oct 13, 2005 at 05:43 UTC ( [id://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)->()

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2024-03-28 17:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found