in reply to Re^2: Splicing Arrays on pre-defined indices
in thread Splicing Arrays on pre-defined indices
my @exclude = (2,5..8); my @exclude_lkup; $exclude_lkup[$_] = 1 for @exclude; my $line = "1!2!3!4!5!6!7!8!9"; my @arr = split /!/, $line; my @filtered = map $arr[$_], grep !$exclude_lkup[$_], 0..$#arr; print("@filtered\n"); # 1 2 4 5
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Splicing Arrays on pre-defined indices
by harishnuti (Beadle) on Jun 28, 2008 at 15:27 UTC | |
Re^4: Splicing Arrays on pre-defined indices
by injunjoel (Priest) on Aug 15, 2008 at 23:55 UTC |
In Section
Seekers of Perl Wisdom