Why not just do it the simple way, as chomp will remove the '>' (if $INPUT_RECORD_SEPARATOR = '>'), then skip empty records & re-add the '>',
somthing like:
use English;
local $INPUT_RECORD_SEPARATOR = '>';
while (my $buf = <$fh>) {
# remove '>' & skip empty records:
chomp($buf);
next if ($buf =~ m/^\s*?$/);
my $fasta = ">$buf\n";
};