drieux, et al -- ...and then drieux said... % % On Saturday, June 8, 2002, at 04:47 , David T-G wrote: % [..] % > ... % > ... % > chop ; chop ; # strip \n\r (no chomp here) ... % % that is way too weird - since that means that what % ever dos app you were using was not complying with % the standard to begin with.
Tell me about the standard... Should perl happily chomp either a UNIX or a DOS (or even a MAC) line? Or do I turn around and explain it below, answering myself? % % your chop/chop here puts you in perl of brutally hacking off % the last letter of your line.... so why not try Oh, I know. I didn't say I liked it :-) % % http://www.wetware.com/drieux/pbl/RegEx/eolOut.txt Ahhh... OK, so cribbing mightily from you I cranked out [zero] [9:59pm] ~/www/private/playlists> foreach i ( *m3u ) echo -n "`basename $i` - " ; head -1 $i | perl -e \ '$cr=chr(13);$lf=chr(10);while(<>) {if (/$cr$lf/) {print "RL\n"} elsif \ (/$lf$cr/) {print "LR\n"} elsif (/$cr/) {print "R\n"} elsif (/$lf/) \ {print "L\n"} else {print "WHAT?\n"}};' end (you know, it can be a real challlenge to write a one-liner!) and found that I have either RL or L for all files, and no \n\r as I had thought, but now I wonder all the more why chomp wouldn't get rid of it after all... Or maybe it *was* peeling off the line feed but nonetheless leaving the carriage return and I couldn't tell the difference. Interestingly enough, it's a mix of RL and plain L, but they were all made under Win98. I'd even say that it could be because of an upgrade to Cygwin, but I have some made around the same time which even go back and forth! Weird. And so much for my theory that all were the same; this would have really screwed me as I got way down into my lists :-) So now I should be able to put ... while(<>) { s/($cr|$lf)+//; ... into my code and basically make my own chomp, right? Time to go off and test... % % I have updated it so that you octal freaks will % still feel loved .... *grin* % % remember - cool is hitting ONLY the target you need to hit % without having to worry about collateral damage.... Oh, I know, and it's definitely my preference. Of course, there's the matter of knowing how to construct the proper weapon. Thanks for the code! % % [..] % ciao % drieux % % --- % % as for the curly brace crisis % ... % BSD style % % <iterative|conditional> % { % <block> % } % [<elseClause> % { % <block> % }]* Definitely me (well, not the depth, but certainly the style), though the opening '[' option bracket goes up to the right of the closing '}' brace to make the line feeds all work out ;-) That explains why it certainly seems to be a school-of-thought thing... % % HEATHEN IDOLATORS: *grin* That was just funny, and I've even seen some code like that. IIRC, the Linux kernel is laid out like that, though I'm sure they set the tabstops down below 8... Thanks & HAND :-D -- David T-G * It's easier to fight for one's principles (play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie (work) [EMAIL PROTECTED] http://www.justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
msg25695/pgp00000.pgp
Description: PGP signature