in reply to print "$var\n" or print $var, "\n"

Another difference: "$_\n" will always DWYW. However, if some naughty person modified $, then $_,"\n" might do something unexpected.

Replies are listed 'Best First'.
Re^2: print "$var\n" or print $var, "\n"
by Fletch (Bishop) on Feb 17, 2005 at 20:07 UTC

    Unless of course someone's mucked with $\ . . .

    $ perl -le '$\="wubba\n"; print "foo\n"' foo wubba

    Update: Good point about printf below. There's also syswrite, for that matter.

      A 'fix' for that: printf :)

      You can always localize it if you're afraid of ghosts.

      Makeshifts last the longest.