in reply to filtering an array
use feature ":5.14"; use warnings FATAL => qw(all); use strict; use Data::Dump qw(dump pp); my @positions; for(split /\n/, <<'END') 1 ACAC 2 AGAC 3 AGTC 4 ACCA END {push @positions, [split/ /] unless /[GT]/; } say "With bases: ", dump(@positions); $_ = $_->[0] for @positions; say "Without bases: ", dump(@positions);
Produces
With bases: ([1, "ACAC"], [4, "ACAC"]) Without bases: (1, 4)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: filtering an array
by philiprbrenan (Monk) on Sep 01, 2012 at 20:15 UTC | |
Re^2: filtering an array
by prbndr (Acolyte) on Sep 01, 2012 at 19:50 UTC |
In Section
Seekers of Perl Wisdom