in reply to Re: Combining Files using Hash
in thread Combining Files using Hash

Hi,

I tried this and "Use of uninitialized value $key in exists at reformat_rpt.pl" and "Use of uninitialized value $key1 in exists at reformat__rpt.pl" are shown. Why does this happen?

Thanks

Replies are listed 'Best First'.
Re^3: Combining Files using Hash
by poj (Abbot) on Sep 05, 2017 at 07:42 UTC
    Why does this happen?

    Maybe you have some blank lines at the end of the file. Add a check like this

    while (my $line1 = <$file2>){ next unless ($line1 =~ /\S/); # skip empty lines chomp $line1;
    poj