in reply to Print only if pattern matches
> I am looking to get rid off the error. ... ANd I want to write the exceptions to new file.
so avoid uninitialized '$2'!
if (defined $2) { print "$1$2|$3\n"; } else { print $exception_fh "$_\n"; } [download]