in reply to Array element getting deleted

See perlsyn about Foreach-Loops. Basically, $_ acts like an alias and the reading from a file overwrites it.

Also, you should learn to check the success of open and to emit error messages. Also, Data::Dumper::Dumper takes an array reference not an array.

Replies are listed 'Best First'.
Re^2: Array element getting deleted
by Bloodnok (Vicar) on Apr 17, 2009 at 11:59 UTC
    Hmmm ,

    ...Data::Dumper::Dumper takes an array reference not an array - not quite true, methinx. It's certainly true that the output is more readable if given a ref. - consider

    pointo1d@pointo1d-laptop:~/workspace/perl$ perl -MData::Dumper -e '@a += qw/0 1 2 3/;warn Dumper \@a,@a' $VAR1 = [ '0', '1', '2', '3' ]; $VAR2 = '0'; $VAR3 = '1'; $VAR4 = '2'; $VAR5 = '3';
    A user level that continues to overstate my experience :-))