http://www.perlmonks.org?node_id=1015090


in reply to Print only if pattern matches

>  Use of uninitialized value $2 in concatenation (.) or string at split_test.pl li

> 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"; }