in reply to look for a word

use strict; use warnings; my @matches; while (<DATA>) { push @matches, $1 if m/The dir is '(.*?)'/; } print join "\n", @matches; __DATA__ sdfdfsddf The dir is '/usr' and there are 23 files sdfsdfdsdds The dir is '/bingo' and there are 16 files