Dave, One possiblity: use strict; open(IN, "lfile.txt"); # ho;d the line from the example in the orig post
my $p1 = join('|', (512..520)); my $p2 = join('|', (528..568)); my $p3 = join('|', (576..578)); my $p4 = join('|', (592..600)); my $p5 = join('|', (608..622)); my $p6 = join('|', (624..670)); my $p7 = join('|', (672..685)); my $p8 = join('|', (768..771)); while (<IN>) { if ( m/,$p1|$p2|$p3|$p4|$p5|$p6|$p7|$p8,/ ) { print "\tFound $_\n"; } } close IN; of course you could further compact the expression further m/,$p0,/ by joining $p1,$p2... I don't mean to post a question with an answer, but how would something like this perform, iwonder. HTH "Dave Chappell" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > 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]