> Hi,
> 
> I have the following code in a script I'm writing:
> 
> foreach my $line (<INN>) {
>     if ( 10 == ($line =~ s/,/,/g) ) {
>         print OUT $line;
>     }
> }
> 
> Is this poor style? It looks a bit ugly, but I can't figure out a
> better way to do it. I'm sure there is :)
> The script will be reused and probably maintained by someone else. Is
> there a more "standard" way of doing this?

for my $line (<INN>) {
    if ( 10 == ($line =~ tr/,//) ) {
        print OUT $line;
    }
}

--
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