in reply to Why is file being slurped in instead of line by line?

It's because you're undefing $/. That's what the perl runtime uses to determine the line-break character (or string). (Well, technically, line-end string, but let's not get carried away.) Comment out that line, and you'll get what you expect.

If you need it for other things, you should localise your changes - see local. e.g.:

{ # I want to slurp here. local $/; # sluuuuuuuurrrrrp... } # $/ is back to normal here.

Replies are listed 'Best First'.
Re^2: Why is file being slurped in instead of line by line?
by Grey Fox (Chaplain) on Aug 26, 2006 at 16:36 UTC
    Thanks; That's what I get for stealing code from something else I had done where I wanted to get rid of the line feed.
    I had a teacher once who used to say. If you can't find something in 5 minutes it is probably a stupid mistake (ie a missing ; or something).
    -- Grey Fox
    Perl - Hours to learn lifetime to master.