Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: filtering an array

by philiprbrenan (Monk)
on Sep 01, 2012 at 19:41 UTC ( #991187=note: print w/replies, xml ) Need Help??

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


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

    The script will work as long as the string is one or more characters long and does not contain spaces.

Re^2: filtering an array
by prbndr (Acolyte) on Sep 01, 2012 at 19:50 UTC

    i should say that the string is just one single letter, either an "A" "T" "G" or "C", not multiple letters combined.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://991187]
[marto]: LanX: I appreciate that, it's honestly a difficult thing, a fine balance
[marto]: I'm sure it'll be fun :)
[marto]: of course I can take you to some of the best/worst bars in Glasgow ;)
[LanX]: is Glasgow that city where catholics and protestants fight in bars? ; )
[marto]: not really, but pick your side, we'll visit some real dumps

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (13)
As of 2017-12-14 15:56 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (397 votes). Check out past polls.