while () { next if /^\s*$/; chop; /^Username\:\s+ (.*?) \s+ Owner\:\s+ (.*?)\s*$/x and do { print "$1,$2,"; next }; /^Last Login:\s+(\d+.*?\:\d+).*,\s*(\d+.*?\:\d+)/ and print "$1,$2\n"; }