$_ = $sentence; print $1,"\n" if /word1(.+)word2/ && 4 < @{[split '\s', $1]};