use strict; use warnings; use 5.010; my @strings = ( 'startHELLO WORLDend', 'startHIend', 'startOK BYEend', ); for (@strings) { /start(.*?)end/; say $1; } --output:-- HELLO WORLD HI OK BYE