in reply to Length of strings in an array

If you really want a fixed number of entries then this variation of NewWalla's reply may help.

use strict; use warnings; my @seq; # DNA sequence strings for my $count (1 .. 4) { print "Please enter DNA sequence $count:"; push @seq, scalar <STDIN>; } chomp @seq; # Remove line endings on all entries printf "%2d: %s\n", length $_, $_ for sort {length $a <=> length $b} +@seq;

Prints (for some arbitrary input):

Please enter DNA sequence 1:asdf Please enter DNA sequence 2:zvasdfasf Please enter DNA sequence 3:asd Please enter DNA sequence 4:asdfasg 3: asd 4: asdf 7: asdfasg 9: zvasdfasf

You can visit PerlDoc to find out what scalar does.

Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond