Loop over @nobreak?
my $s="MALWMRLLPLLALLALWGPDPAAAFVNQHLCGSHLVEALYLVCGERGFFYTPKTRREAEDLQVGQVELGGGPGAGSLQPLALEGSLQKRGIVEQCCTSICSLYQLENYCN";
print "Results of 1-Missed Cleavage:\n\n";
my @nobreak = (37,45,57,59);
for my $nobreak (@nobreak) {
substr($s, $nobreak-1, 1) = "\0";
my @a = split(/E(?!P)/, $s);
substr($s, $nobreak-1, 1) = 'E';
$_ =~ s/\0/E/g foreach (@a);
$result = join ("E,", @a);
@final = split(/,/, $result);
print "@final\n";
}
solved Generating sets of array in perl