in reply to Extracting substrings

Use a non-greedy match (same as a greedy match, but with "?" after it).

use Data::Dumper; my $string = 'WhateverFooBlahBarMoreFooStuffBarMore'; my @words = ( $string =~ /Foo(.*?)Bar/g ); print Dumper \@words; __END__ $VAR1 = [ 'Blah', 'Stuff' ];