in reply to Determine whether file is dos or unix format
if (/\x0D\x0A/) { die "DOS files not allowed" }
If you're reading it a line at a time, you can do this for the first line or for every line, depending on how picky you want to be. If you're reading the whole thing into memory, using that pattern across the whole file will work.
Update: Use hex escapes instead of \r\n for better portability. Thanks ikegami and GrandFather.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Determine whether file is dos or unix format
by ikegami (Patriarch) on Nov 28, 2005 at 21:32 UTC | |
by nevyn (Monk) on Nov 29, 2005 at 20:05 UTC |