while (my $line = ) { #if ($line =~ m!^(\d+)\s+(([A-Za-z]+\s+[A-Za-z].\s+[A-Za-z]+)|([A-Za-z]+\s+[A-Za-z]+) )!) { if ($line =~ m! ^(\d+)\s+ ([^\d]+) ((?:\w+\s)+) (\w+)\s (\w\w)\s (\d{5})\s ([\d\-]+)\s (.*)\s$ !x) { print "\n"; print "\$1: $1 \n"; print "\$2: $2 \n"; print "\$3: $3 \n"; print "\$4: $4 \n"; print "\$5: $5 \n"; print "\$6: $6 \n"; print "\$7: $7 \n"; $custNum = $1; # First number field. $custName = $2; # Name styles can vary + so match everything between two numbers. $custStreet = $3; # Street is everything + after name and before CITY. $custCity = $4; # City is after addres +s and before the TWO char state identifier. $custState = $5; # State is after addre +ss and before FIVE digit zip number. $custZip = $6; # Zip is before teleph +one number and after State id. $custTel = $7; # Telephone no. is aft +er zip and before comments field. $custComments = $8; # Last remaining part +after telephone number. } } __DATA__ 141 Martha Lynn Costello 11750 Old Mill Drive Media PA 19063 610-555-1212 no detail 178 Edgar Jones Jr. 18013 Highfield Road Ashton Ma 20861 323-774-1339 no detail 161 Joyce W. Whang 18 Long Point Lane Media PA 19063 610-891-2344 no detail 188 Alex Smith 1979 Biltmore St NW Apt B Washington DC 20009 202-913-6685 no detail