RE: Counting occurences of a char in a line

2005-01-17 Thread Bakken, Luke
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

Re: Counting occurences of a char in a line

2005-01-17 Thread John W. Krahn
Tor Hildrum wrote: Hi, Hello, 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

Re: Counting occurences of a char in a line

2005-01-17 Thread Jenda Krynicky
From: Tor Hildrum [EMAIL PROTECTED] 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

Re: Counting occurences of a char in a line

2005-01-17 Thread Tor Hildrum
On Tue, 18 Jan 2005 01:08:56 +0100, Jenda Krynicky [EMAIL PROTECTED] wrote: foreach my $line (INN) { if ( $line =~ /^[^,]*(?:,[^,]*){10}$/) ) { print OUT $line; } } That is check whether the full string is something not containing comma followed by ten times comma and