#!/usr/bin/perl use strict; use warnings; # 794700 while(){ # if($_ =~ m/\bpublication date\b/){ if($_ =~ m/\bpublication date\s/){ print $_; } } __DATA__ These are the dates. The publication date is 20-10-09 The publicatiion dateee is 20-05-08 The publication dat is 10-06-07 The publication date's are 20-10-09,29-02-08 #### perl 794700.pl The publication date is 20-10-09 The publication date's are 20-10-09,29-02-08 #### perl 794700.pl The publication date is 20-10-09 #### The publication date is 20-10-09 The publication dates are 20-10-09, 29-02-08)