I am trying to assign the mutiple values of a key in a hash to multiple variables but getting "Use of uninitialized value $value2 in concatenation (.) or string at checking.pl line 39." error though the values of the keys are assigned to the variables. How do I eliminate these error messages?

#!/usr/bin/perl use strict; use Term::ANSIColor; use warnings; use Crypt::Random qw( makerandom ); #--------------------------------------------------------------------- +-------- #RANDOM NUMBER GENERATION FOR NNBENCH #--------------------------------------------------------------------- +-------- #print color 'bold blue'; print "NNBENCH TEST TO START\n\n"; my $nn_map = makerandom ( Size => 5, Strength => 1 ); my $nn_reduce = makerandom ( Size => 4, Strength => 1 ); my $nnblock_size_low = makerandom ( Size => 7, Strength => 1 ); my $nnblock_size_medium = makerandom ( Size => 10, Strength => 1 ); my $nnblock_size_huge = makerandom ( Size => 11, Strength => 1 ); my $nnbyte_size_low = makerandom ( Size => 7, Strength => 1 ); my $nnbyte_size_medium = makerandom ( Size => 9, Strength => 1 ); my $nnbyte_size_huge = makerandom ( Size => 14, Strength => 1 ); my $nnfile_number_low = makerandom ( Size => 7, Strength => 1 ); my $nnfile_number_medium = makerandom ( Size => 9, Strength => 1 ); my $nnfile_number_huge = makerandom ( Size => 14, Strength => 1 ); my @nnnumber_of_file_low = ("$nnblock_size_low", "$nnbyte_size_low"); my @nnnumber_of_file_medium = ("$nnblock_size_medium", "$nnbyte_size_m +edium"); my @nnnumber_of_file_huge = ("$nnblock_size_huge", "$nnbyte_size_huge" +); my %nn_file = ($nnfile_number_low => "@nnnumber_of_file_low" , $nnfile +_number_medium => "@nnnumber_of_file_medium", $nnfile_number_huge => +"@nnnumber_of_file_huge");; foreach my $key ( keys %nn_file ) { my ($value1,$value2) = $nn_file{$key}; print "key is $key value is $value1 $value2"; ERROR #perl checking.pl NNBENCH TEST TO START Use of uninitialized value $value2 in concatenation (.) or string at c +hecking.pl line 39. Use of uninitialized value $value2 in concatenation (.) or string at c +hecking.pl line 39. Use of uninitialized value $value2 in concatenation (.) or string at c +hecking.pl line 39. key is 120 value is 93 84 key is 8364 value is 1435 8883 key is 405 +value is 647 313

In reply to assign multiple values of a key in hash to multiple variable by rahulruns

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.