in reply to Create the reverse complement DNA sequence without pattern matching and reverse built-in function?

Not recommended for production:

use strict; use warnings; my $seq='ACGGGAGGACGGGAAAATTACTACGGCATTAGC'; my $rev=''; my $n = length $seq; while( $n-- ){ $rev .= $_ for map chr($_&2?$_^4:$ +_^21), ord substr $seq, $n, 1 } print "$seq\n$rev\n";

Something reminds me of Black Jack...

Update: ...or:

use strict; use warnings; my $seq='ACGGGAGGACGGGAAAATTACTACGGCATTAGC'; my $rev=''; $rev = "$_$rev" for map chr($_&2?$_^4:$_^21), map ord, split//,$seq; print "$seq\n$rev\n";
  • Comment on Re: Create the reverse complement DNA sequence without pattern matching and reverse built-in function?
  • Select or Download Code