in reply to Re: need help to fix "use of uninitialized value..."
in thread need help to fix "use of uninitialized value..."

I tried: ... And the end results were the same.

$Person1, $Person2 are not the problem

The problem is %Pairs and %PairsOf

$PairsOf{$Person1} is not defined (it is uninitialized), but you assign to it the value of $PairsOf{$Person1} (an uninitialized value)

Its like writing

my $foo = undef; my $bar = 'bar'; $foo = $foo . $bar; # UNITIALIZED!!!

Get it?

Replies are listed 'Best First'.
Re^3: need help to fix "use of uninitialized value..."
by mlebel (Hermit) on Feb 18, 2012 at 01:52 UTC

    You are confirming what I suspected...And I understand what you are saying... The only problem is that I tried your code and it doesn't seem to give the expected result

    #!/usr/bin/perl use warnings; use strict; my $foo = undef; my $bar = 'bar'; $foo = $foo . $bar; # UNITIALIZED!!! print "foo = <$foo>\n";
    prints: foo = <bar>

    So thanks for the help though, It still help's me understand what is happening.