#!/usr/local/bin/perl # Ask user to enter no. of translated nucleotides in a mRNA # sequence, and calculate no. of amino acid in the resulting protein. # Repeat asking user for the number until the entered value is # positive and divisible by 3. my ($nuc, $aa); { print "please enter no. of translated nucleotides: "; $nuc = ; chomp ($nuc); if ($nuc <= 0) { print "wrong input - negative or zero number\n"; redo; } if ($nuc % 3 != 0) { print "wrong input - number not divisible by 3\n"; redo; } } $aa = $nuc / 3; print "no. of amino acids: $aa\n";