Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Addressing object variables

by BrowserUk (Patriarch)
on Sep 03, 2010 at 13:28 UTC ( [id://858711]=note: print w/replies, xml ) Need Help??


in reply to Addressing object variables

Use:

print "Saved data to ", $response->filename, "\n\n"; ## or printf "Saved data to %s\n\n", $response->filename; ## or print "Saved data to " . $response->filename . "\n\n"; ## or (though you'll be condemned for doing it:) print "Saved data to ${ \$response->filename }\n\n";
(and why is it different inside of the print statement)?

It isn't "different inside a print statement". It is different inside a double-quoted string.

Perl usefully interpolates (replaces) recognisable variable names with their current values inside double-quoted strings. But method calls aren't values, they are code execution. To obtain the value you have to run the code, and that'd be more like eval than interpolation.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-25 06:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found