while (<$FILE>) { if (/(\S+)\s+going\s+(\S+)/) { print "before: '$1'; after: '$2'\n"; } }