use strict; use warnings; my $string='foo bar baz bow'; if ($string =~ /bar(.*)bow/) { print "between bar and bow is '$1'\n"; } #### $ perl x.pl between bar and bow is ' baz '