http://www.perlmonks.org?node_id=197797


in reply to Re: DNA Reverse Complement
in thread DNA Reverse Complement

sub revcompl { return map { (my $rev = reverse $_) =~ tr/ACGTacgt/TGCAtgca/; $rev + } @_ }

Makeshifts last the longest.

Replies are listed 'Best First'.
Re^3: DNA Reverse Complement
by Anonymous Monk on Aug 20, 2009 at 17:19 UTC
    The above sub does not work

      Of course it does. I'm guessing you called it in scalar context and got the count of the transform; e.g., 1.

      print revcompl("CGTAGTC"), $/; # GACTACG print scalar revcompl("CGTAGTC"), $/; # 1

      There was just a post on this issue this morning: Mini-Tutorial: Scalar vs List Assignment Operator.