Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re^3: Matching string, then getting next line

by cas2006 (Novice)
on Mar 08, 2006 at 23:47 UTC ( #535288=note: print w/replies, xml ) Need Help??

in reply to Re^2: Matching string, then getting next line
in thread Matching string, then getting next line

> THe problem with that is, that when perl reads my file
> which was created on windows, it treats the whole file as one line

that's odd. most MSDOS/Windows files use CR/LF as the end-of-line marker, but it sounds like your file uses just CR...are you sure it's a DOS file and not a Mac file?

to read MSDOS/Windows text files, you need to set the input record separator to CR/LF rather than newline (actually, this isn't strictly necessary. if you don't do it, you just end up with a CR at the end of each line. chomp will get rid of it)



to read Mac text files, set it to just CR:


see the man page for 'perlvar' for more info.

  • Comment on Re^3: Matching string, then getting next line

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://535288]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2020-10-30 02:12 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (277 votes). Check out past polls.