in reply to regex needed

It's not `grabbing the entire line', because $_ is the entire line. Just matching against a regex doesn't change anything. You either need to use ()s to capture the parts of the data you're interested in, or use s/// to remove the parts you're not. See perldoc perlretut.