#!/usr/bin/perl use strict; use warnings; open (FILE,"test.txt"); my $total=0; while () { $total=$total+s/>/>/g; } print $total;