Both good points...I was not aware that [\d] was the same as \d...that's really neat!
As for the $1 issue, you might try while( $line =~ /((\d\d?-\d\d?)|(T+))/g ) { push @snow, $1; } ----- Original Message ----- From: "John W. Krahn" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, January 14, 2002 5:50 PM Subject: Re: A regex question > Tanton Gibbs wrote: > > > > If you know they will always be around -, then you might be able to do > > something like: > > > > while( $line =~ /(\d\d?-\d\d?)|(T+)/g ) { > > push @snow, ($1 || $2); #T will be $2, not $1 > ^^^^^^^^ > This won't work because once $1 has been set it retain that value until > it is reset by another match so it will be true and $2 will not be > used. Of course if it has the value of zero it will be false and $2 > will be used, whether it has a value or not. > > while( $line =~ /(\d\d?-\d\d?|T+)/g ) { > push @snow, $1; > > > > } > > > > Also, I'm not sure why you had all of the [], they make a character class > > which is probably not what you want. > > \d _is_ a character class (as are \D \w \W etc.) \d is the same as > [0-9] or [\d] (where the brackets are redundant) > > > > John > -- > use Perl; > program > fulfillment > > -- > 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]