Dave, Thanks a bunch for the help - it worked. I had to change the line to if ($line =~ /^\r\n?/) { etc ... To catch the empty lines.
Best, Bruce On 11/16/04 10:34 PM, "Dave Gomez" <[EMAIL PROTECTED]> wrote: > Bruce, > depending on the platform of the originating text file, and in OSX that > covers 2 bases really, the newline character is different. > > Moc OS9 & below = \r > Unix = \n > Dos = \n\r > OSX = \n but many text files are still \r from legacy > > So, to make you code good all around, try this instead > > if ($line =~ /^\n|\r\n?/) { > # Do Something > } > > > Dave > > On 11/16/04 7:53 PM, "Bruce Pascal" <[EMAIL PROTECTED]> wrote: > >> All, >> >> I am having a problem with a parser which works in DOS, but does not work in >> the OS X BSD shell. The problem is trying to find lines that begin with a >> newline character. I have tried exactly the same source files, but it >> doesnšt work. Herešs the code: >> >> if ($line =~ /^\n/) { >> # Do Something >> } >> >> Why would this happen? Any ideas? >> >> -Bruce >> >> > >