Ravendark has asked for the wisdom of the Perl Monks concerning the following question:
and I get the message: Use of uninitialized value in join or string at ./test.pl line 7. Why is this happening and how can I fix it? Isn't $i initialized with 0 inside the for loop? Thanks in advance.@array = (2, 25, 2, 26, 2, 27, 2, 28, 2, 29); for ($i = 0; $i < @array; $i++) { print "Slot: $array[$i*2], port: $array[$i*2 + 1]\n" }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Accessing array elements
by almut (Canon) on Jun 18, 2009 at 13:40 UTC | |
|
Re: Accessing array elements
by Corion (Patriarch) on Jun 18, 2009 at 13:35 UTC | |
|
Re: Accessing array elements
by davorg (Chancellor) on Jun 18, 2009 at 13:59 UTC | |
by JavaFan (Canon) on Jun 18, 2009 at 15:02 UTC | |
by AnomalousMonk (Archbishop) on Jun 18, 2009 at 16:40 UTC |