use strict; ## Simplified for testing my @numberMutation = (); while () { chomp; @numberMutation = split(//,$_); } my @organism = (1,1,1,1,1,1,1,1,1); foreach (@numberMutation) { my $currentMutation = $_; my $i = 0; foreach (@organism) { if ($_ < $currentMutation) { $organism[$i] = $currentMutation; $i++; } } } print "ORG: @organism\n"; ## prints ORG: 9 9 9 9 9 9 9 9 9 print "MUT: @numberMutation\n"; __DATA__ 31415926535897932384626433832