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.
|
|---|