Hi  Chris,
   Please, check my comment within your script and a "snap shot" script I
wrote below if that could point you in the right direction, since we don't
have access to your complete codes.

On Wed, Mar 28, 2012 at 5:05 AM, Chris Stinemetz
<chrisstinem...@gmail.com>wrote:

> Hello list,
>
> I am getting the results I want with this iteration through the hash,
> but I am stump on clearing the following warnings:
>
> fyi line 12168 is the last line of the input file.
>
> Use of uninitialized value in concatenation (.) or string at
> ./TESTdeltaT1.pl line 54, <$SUM> line 12168.
> Use of uninitialized value in concatenation (.) or string at
> ./TESTdeltaT1.pl line 54, <$SUM> line 12168.
> Use of uninitialized value in concatenation (.) or string at
> ./TESTdeltaT1.pl line 54, <$SUM> line 12168.
> Use of uninitialized value in concatenation (.) or string at
> ./TESTdeltaT1.pl line 54, <$SUM> line 12168.
> Use of uninitialized value in concatenation (.) or string at
> ./TESTdeltaT1.pl line 54, <$SUM> line 12168.
> Use of uninitialized value in concatenation (.) or string at
> ./TESTdeltaT1.pl line 54, <$SUM> line 12168.
> Use of uninitialized value in concatenation (.) or string at
> ./TESTdeltaT1.pl line 54, <$SUM> line 12168.
>
> Any ideas on how to resove it?
>
> code snippet:
>    51  foreach my $cell ( @wanted ) {
>    52    print $DELTA "$cell:";
>    53    foreach my $hr ( @hours ) {
>    54      if ( defined keys %{ $href->{$hr}}){
>    55        print $DELTA "\t$href->{$cell}{$hr}";

    Please, check the order, why  $href->{$cell}{$hr}, since you initially
wrote $href->{$hr} in line 54.


>    56      }
>    57      else {
>    58        print $DELTA "\t";
>    59      }
>    60    }
>    61    print $DELTA "\n";
>    62  }
>

   check this:

#!/usr/bin/perl
use warnings;
use strict;

my @wanted   = qw( dad mum children);
my @children = qw(tim dan mercy);
my $ref      = {
    dad      => "mick",
    mum      => "eliz",
    children => { first => 'tim', second => 'dan', third => 'mercy', },
};

foreach my $cell (@wanted) {
    print STDOUT "$cell:";
    if ( defined keys %{$ref} ) {
        print STDOUT $ref->{$cell}, "\n" if !ref( $ref->{$cell} );
        if ( ref( $ref->{$cell} ) ) {
            foreach my $child ( keys %{ $ref->{$cell} } ) {
                print STDOUT $ref->{$cell}{$child}, "\n\t";
            }
        }
    }
}

*OUTPUT*

dad:mick
mum:eliz
children:tim
            dan
            mercy

Regards,
tim

Reply via email to