Quite!  Even the slowest may find redemption in clarity :)

my @arr = qw( zero one two three ... );
my @del = qw( 2,4,... );

my( %del, @new );
@del{ @del } = ();
for (0..$#arr) { push @new, $arr[$_] unless exists $del{$_}}

On Wed, Apr 12, 2017 at 2:18 PM, Paul Johnson <p...@pjcj.net> wrote:
> On Wed, Apr 12, 2017 at 11:12:45PM +0200, David Emanuel da Costa Santiago 
> wrote:
>
>> Thank you all for your replies.
>>
>> I tested the 5 solutions with the benchmark module, and the splice one
>> is the fastest:
>
>> The hash one, which was my first solution is the slowest one. :-(
>
> But they're all fast enough.  Or none of them are.  So choose the
> solution which is the clearest.
>
> --
> Paul Johnson - p...@pjcj.net
> http://www.pjcj.net
>
> --
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
>
>

-- 
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