in reply to Grepping for a value in a hash of filenames and printing the matches

Change:

$Hash_filenames{$plf}=@file_lines;

To:

$Hash_filenames{ $plf } = \@file_lines;

And change:

$Hash_filematches{$filename}= grep( /\/\Q$file_name\E#/i, $Hash_filen +ames{$plf} );

To:

@{ $Hash_filematches{ $filename } } = grep /\Q/$file_name\E#/i, @{ $Ha +sh_filenames{ $plf } };

Replies are listed 'Best First'.
Re^2: Grepping for a value in a hash of filenames and printing the matches
by iphone (Beadle) on Oct 28, 2010 at 00:32 UTC
    Thanks for the reply.

    I am getting "Use of uninitialized value in hash element at orphan_plf.pl line 40" and line 40 is @{ $Hash_filematches{ $filename } } = grep( /\/\Q$file_name\E#/i, @{ $Hash_filenames{ $plf } });

    and the output is PRINTING MATCHED HASHES apps.plf => ARRAY(0x1981c80) modem.plf => ARRAY(0x1981ca4) ...........

    1.I am confused on why apps.plf is showing beacause the file we are grepping is not in this PLF. 2.the output is printing the reference values,how do I fix this?Please help