I have prepared a short loop that looks like this:
@array = ("a", "b", "c", "d", "e");
$count=0;
print "@array\n";
foreach $string(@array){
$number=$count++ +1 ;
$string{$link} = $number;
print "$string\n$string{$link}\n";
}
It should come out as
a
1
b
2
... and so on. It works but when I print it out on the terminal, I get warning messages:
Use of uninitialized value $link in hash element at ./hashing_an_array.pl line 11.
Use of uninitialized value $link in hash element at ./hashing_an_array.pl line 12.
a
1
Use of uninitialized value $link in hash element at ./hashing_an_array.pl line 11.
Use of uninitialized value $link in hash element at ./hashing_an_array.pl line 12.
b
2
...
etc
Why do I get these messages? I just wanted to know so that even though it works, I am sure I know what I am doing.