Hello

Try with this code:

use strict;
use warnings;
use Data::Dumper;

my @words = ("this","that");

# With this code
$words[5] = "bad idea";

print Dumper \@words;

And it outputs:

$VAR1 = [
          'this',
          'that',
          undef,
          undef,
          undef,
          'bad idea'
        ];


so $words[2], $words[3], $words[4] have been defined as undef automatically.

You'd better use a "push" method for a list operation like this.

Thanks


William Torrez Corea wrote:
What happen with my code?

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to