http://www.perlmonks.org?node_id=468691


in reply to On bad habits

These days I find myself using the "-l" perl option a lot, and I rarely need to put explicit "\n"'s in my code (maybe for printf). A nice bit of laziness/DWIMery. Perhaps that would help you break your habit.

Update: Thanks, !1, I didn't know that, but it makes abundant sense. I suppose I've never run into it before because I don't use a lot of modules that have their own file IO.

Replies are listed 'Best First'.
Re^2: On bad habits
by !1 (Hermit) on Jun 21, 2005 at 16:10 UTC

    Use it only if you aren't using modules which are expected to manipulate files. I learned this the hard way when I wrote a throwaway script that used Archive::Zip and couldn't figure out why it wouldn't create a valid zip.

Re^2: On bad habits
by DrHyde (Prior) on Jun 22, 2005 at 07:35 UTC
    How does use of -l affect modules which aren't expecting it? The docs indicate that they will double-space anything they print.