in reply to Counting no of '>' symbol in a file

Instead of substitution or matching you could use tr.

$ perl -Mstrict -Mwarnings -E ' open my $fastaFH, q{<}, \ <<EOF or die $!; > Seq 1 CTGTCA GTCCTC > Seq 2 GGCTA > Seq 3 CATGAG ATTCG EOF my $seqCt = 0; $seqCt += tr{>}{} while <$fastaFH>; say $seqCt;' 3 $

I hope this is of interest.

Cheers,

JohnGG