my @patterns = ( "(.*?)", # ID "(.*?)", # Time Stamp "(.*?)", # IP Address "(.*?)", # Title "(.*?)", # Reporting Entity "(.*?)", # Reporting Entity Contact "
(.*?)
", # Reporting Entity Address "(.*?)", # Reporting Entity Email ); my @xml_files = <*xml>; for my $file (@xml_files) { for my $pattern (@patterns) { ... if ($line =~ $pat) { ... } }