Tuesday, July 28, 2009

In PERL: Does anyone know how can I scramble the characters in a string?

I have a sequence with 4 different characters (AAACCCGGGTTT), and I want to scramble them to make a different sequence using PERL.


HEEEEELP!!!

In PERL: Does anyone know how can I scramble the characters in a string?
use List::Util qw( shuffle);


my $s1 = 'AAACCCGGGTTT';


my $s2 = join('', shuffle(split('', $s1)));


print $s2;


No comments:

Post a Comment