while () { # lol, comments in __DATA__ :) next if m/^#/; #m!! to allow for better-readable slashes inside the regex #/x modifier to make the regex even better readable ($date, $address) = $_ =~ m! .*? (\d+ / \d+ / \d+)? \s* (.+) !x; print "date:<$date>\naddress:<$address>\n\n"; } __DATA__ # a line without a date A very good looking address # a line with a date 15/5/85 That's my actual birth day!