in reply to Re^2: Shuffling codons
in thread Shuffling CODONS

If I try the list util it doesnt work

Not enough information there. Error message? Segfault? Compilation error?

What is wrong/missing here?

This line:

@trips = join(" ", @trips);

ruins it. What do you understand this line to be doing? Without it I get at least some shuffling which may or may not be what you want:

#!/usr/bin/env perl use strict; use warnings; use List::Util 'shuffle'; print "enter sequence and signal end with enter followed by ctrl d\n"; my $sequence = <STDIN>; chomp $sequence; print "sequence inserted : $sequence\n"; my @trips = unpack("a3" x (length($sequence)-2), $sequence); my @shuffled = shuffle(@trips); print "@shuffled\n";

which gives:

$ perl /tmp/shuf.pl enter sequence and signal end with enter followed by ctrl d aaabbbcccddd sequence inserted : aaabbbcccddd ccc aaa ddd bbb
I am on perl v5.18.2, so the list utils should already be there you mention?

Yes.