Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

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)->()

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://499766]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2017-07-26 04:14 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (383 votes). Check out past polls.