in reply to Removing items from an Array Reference in Place

use strict; use warnings; my $arrayref = ['a', 'b', 'c', 'd', 'e', 'f']; splice(@$arrayref, 1, 2); # remove 2 items, starting at index 1 print "@$arrayref\n"; my @replacements = ('x'); splice(@$arrayref, 1, 1, @replacements); # replace 1 item, staring at +index 1 print "@$arrayref\n"; my @insert = ('l'); splice(@$arrayref, 3, 0, @insert); # replace 0 items (i.e. doing an in +sert), staring at index 3 print "@$arrayref\n";
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Replies are listed 'Best First'.
Re^2: Removing items from an Array Reference in Place
by theleftsock (Beadle) on Jan 09, 2013 at 17:53 UTC
    After searching more carefully. I found some ways to do this posted to perlmonks. I used the undef method posted by BrowserUk using grep. This thread perlmonks remove array items node Thanks for the help! -theleftsock