Michael Robeson wrote:
I decided to use the if statement you posted:

<snip>

only because I had to add a $count++ function within the else
statement (shown below) to accomplish another task within my larger
script:

    if ( $aa eq '-' ) {
                $hash3{$_} .= '---';
            } else {
                $hash3{$_} .= substr $dna,0,3,'';
                    $count++
    }

I couldn't figure out if it was possible to add $count++ within the
?: statement above. I tried but could not get it to work.

Right, the conditional operator is merely designed for assignment.

OTOH, you don't need a loop to count a certain type of characters in a
string:

    my $string = 'mfg--f';
    my $count = $string =~ tr/a-z//;

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

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