in reply to Re: combining 2 files with 4 columns need help
in thread combining 2 files with 4 columns need help

I am getting following message when running script "Can't use an undefined value as an ARRAY reference at script.pl line 34."

lines 33 & 34 my @dates = @{$hash{$pk}[1]}; my @rdates = @{$hash{$pk}[2]};

thanks so much for your help

Replies are listed 'Best First'.
Re^3: combining 2 files with 4 columns need help
by poj (Abbot) on May 29, 2013 at 19:24 UTC
    Looks like you have a primary key in one file only. Add a print to confirm ;
    print "$pk\n"; my @dates = @{$hash{$pk}[1]}; my @rdates = @{$hash{$pk}[2]};
    poj

      you are right it has a primary key in only 1 file, this will occur potentially in either file. one date is order date the other is release date..can it be taken into account?

      thanks so much

        Yes OK, try
        my @dates = (defined $hash{$pk}[1]) ? @{$hash{$pk}[1]} : (); my @rdates = (defined $hash{$pk}[2]) ? @{$hash{$pk}[2]} : ();
        poj