in reply to extract only uppercases from string

Here's another option:

use Modern::Perl; my $str = 'G_I1E2_GTGGAG^303CTGgacgCCCTGC_I2E3_TACA'; say for map s/[^ACGT]//gr, split 'gacg', $str;

Output:

GGTGGAGCTG CCCTGCTACA

The following will produce the same printed output, but it's actually a single string with an embedded \n separating the two segments:

say $str =~ s/gacg/\n/r =~ /[ACGT\n]/g;