$content= "bla foo bar letters stuff qwerty"; if ($content =~ /bla (.*?)qwerty/){ print "matched!\n"; @stuff = split /\s+/, $1; print "The stuff ".join(" ", @stuff)."\n" if @stuff; }