in reply to Question about WWW::Mechanize::Link string interpolation
The difference is that one is in quotes and the other one isn't. Method calls don't get interpolated; just scalar and array variables get interpolated (including indexed arrays and array slices, with or without dereferences). In your example, $_ is getting interpolated, but the ->url() bit is treated as just plain text. (You can see it at the end of every line in the output.) Working alternatives:
print "Would get --> ", $_->url(), "\n"; or print "Would get --> " . $_->url() . "\n"; or print "Would get --> @{[ $_->url() ]}\n";
|
|---|