> I will be getting the files from different platforms > (i.e. Unix or Windows). Is there a way I can automatically > detect the line endings and accordingly use the chomp > function to remove it.
You need to remember Mac's have Yet Another Newline Sequence, which makes the whole exercise rather painful. The simplest solution is probably to slurp the file (local $\ = undef), then detect the first occurence of each of the three newline sequences and choose the first one that occurs. Then, take the slurped file and use 'split' to break it down into the individual lines. This is basically a hack, there isn't any "good" ways to do it - unless you want to break into raw binary mode. Hopefully Perl 6 will allow a regex pattern for the input record seperator. According to "Programming Perl", AWK does allow a pattern... so you might want to consider using AWK to preprocess the files that don't use the One True Newline Sequence (Unix). Jonathan Paton ===== $_=q|.,&@$$. ,.@$&@$. .&$$@. ,,$ ....!$_=$p.'&$@.',y'&$@' .,';for(/\S+/g){ !|.q| .$ .,@, ,$, .,.. @, ,$ ,,@ .,,.!++$.<22?${'y'.$_}=chr$.+64:[$$=${'y' !|.q| ,@$@&.,. $$$&, ..@&&$,,, $., ..!.$_},$y.=($.=~/22\|26\|3(3\|7)/x?' ' !|.q|. @ ., ,.&,,, , .$..&. .,$ .,,!.$$:"\l$$")]};$y=~/ (.*)/;warn"$1\n" !|.q|. $ .,. .,$$&&$...&., @.,.&@$@ .|,map{-$|--?$r:$p.=$_}split'!';eval$r __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]