Unfortunately, the range operator doesn't work in a regex...though it would be nice if it did (of course I could be wrong)... I would try something like:
while( <IN> ) { while( /,\d+,/g ) { if( in_range( $1 ) ) { # do whatever last; #get out of the while loop } } } The first while loop will loop through the lines of the file as you already know. The second while loop will loop through the numbers that are surrounded by commas. If one of them is in_range (I leave it to the reader to devise an appropriate in_range function), then it will do the appropriate actions and break out of processing the current regex. It will then continue on to the next line. ----- Original Message ----- From: "Dave Chappell" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, May 10, 2002 10:55 AM Subject: Matching a range > I read a file line by line, on each line if any numbers in the range > specified below exist between comas, > > Example: > Line 1> hello,world,123,, > Line 2> The grass,456, is,greener, > Line 3> On,533,the,other, side > Line 4> As, long, as the,10000,grass is watered > Line 5> Bye,world,680,, > > print the line to another file. I have tried different variations. In the > example above and based on my ranges, line 3 & 5 should be printed to > another file. Where am I going wrong? > > > while (<IN>) { > if > (/,[512..520|528..568|576..578|592..600|608..622|624..670|672..685|768..771] > ,/){ > print OUT; > } > } > > > > Regards, > > Dave Chappell > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]