llancet has asked for the wisdom of the Perl Monks concerning the following question:
What I want is to delete the array element in 1 3 5, but why I get ('a',undef,'c',undef,'e'), which is opposite?use strict; use Data::Dump ('dump'); my $listref = ['a','b','c','d','e']; #### delete @{$listref}[1,3,5]; #### this line is crazy, it should be: delete @{$listref}[0,2,4]; print dump($listref),"\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: delete array element from array ref
by GrandFather (Saint) on Aug 22, 2008 at 05:15 UTC | |
by jlf (Scribe) on Aug 22, 2008 at 06:14 UTC | |
by GrandFather (Saint) on Aug 22, 2008 at 07:42 UTC | |
by tinita (Parson) on Aug 23, 2008 at 19:17 UTC | |
|
Re: delete array element from array ref
by Your Mother (Archbishop) on Aug 22, 2008 at 05:17 UTC | |
|
Re: delete array element from array ref
by Skeeve (Parson) on Aug 22, 2008 at 04:42 UTC | |
|