perlquestion
neilwatson
Greetings,
This code is producing continuous errors. What have I done wrong?
<code>
Use of uninitialized value $i in array element at
/home/neil/src/perltest/foo.pl line 25.
label kept
</code>
<code>
#!/usr/bin/perl
use strict;
use warnings;
use feature 'say';
my $aref = [
[
'kept', 82
],
[
'notkept', 1
],
[
'repaired', 3
]
];
say Dumper $aref;
foreach my $i ( @{ $aref } )
{
say "label ". $aref->[$i][0];
}
</code>
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-104468">
<p>
Neil Watson<br>
<a href="http://watson-wilson.ca">watson-wilson.ca</a>
</div></div>