in reply to Re: Storing the log file name as key/value in hash
in thread Storing the log file name as key/value in hash

Thank you. Sorry, i didn't get how this has to be compared to my array

 /^(.+?)\.(.+?)\.IP/ and push $hash1{$2}->@*, $1 for @array;

This gives me Syntax error.

Replies are listed 'Best First'.
Re^3: Storing the log file name as key/value in hash
by tobyink (Canon) on May 28, 2017 at 07:22 UTC

    Try this, or use a more recent version of Perl.

    /^(.+?)\.(.+?)\.IP/ and push @{$hash1{$2}}, $1 for @array;
      Thank you so much. One last thing please need to write the output to a file as

      keyValue : <comma separted values>

      Thanks once again for your time.

Re^3: Storing the log file name as key/value in hash
by huck (Prior) on May 28, 2017 at 07:22 UTC

    This is an older syntax style that does the same

    /^(.+?)\.(.+?)\.IP/ and push @{$hash1{$2}}, $1 for @array;

      Thank you so much. One last thing please need to write the output to a file as

      keyValue : <comma separted values>

      possibly file name with each key and value Thanks once again for your time.

        for my $key (keys(%hash1)) {print $key.':'.join(',',@{%hash1{$key}})."\n";}