my $data =">DL;H1_ENSP00000194530_chr2_202024 CCCC---GCCTTCTCGCTGCCCAGC--CCCGGGGAGGGAGG*"; $data =~ s/[-*]|DL;//g; # globaly, replace all "-" or "*" OR "DL;" with nothing # ignores possibility "DL;" appears elsewhere in data # if that's an issue, you might want to do two substitutions # $data =~ s/[-*]//g; and $data =~ s/(>)DL;/$1/g; # though that last is NOT tied to the beginning of the line # which appears to be subject to brain_block at the moment print $data; =head OUTPUT perl dataclean.pl >H1_ENSP00000194530_chr2_202024 CCCCGCCTTCTCGCTGCCCAGCCCCGGGGAGGGAGG =cut