On Apr 22, 2004, at 8:54 AM, rmck wrote:

hi,

I have a while statement that does a next if a match is made against a reg exprerssion of some numbers.


data file: Header 10 20 5201 8001 0 80 3802



#!/bin/perl
use strict;
use warnings;

while( <> ) { #read from stdin one line or record at a time.
next if $_ =~ /(20|80|Header|)/; # =~ means match not equal to.
print ;
}


results:
bash-2.03$ ./clean.pl data.txt
10
0
bash-2.03$

I would like it to have the results as so:
10
5201
0
8001
3802


How do I force my reg exp to match only 20, and 80. Not 8001 or 5201?

next if m/^(?:Header|[28]0)$/;


Hope that helps.

James


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to