output I am getting everytime is "At least one of the characters in the string you entered is not "A"print "Please enter a string:\n"; $string=<>; chomp ($string); # The first position in the string. $position = 0; while ($position < length($string)) { $char = lc(substr($string, $position, 1)); if ($char ne "a") { last; } # Increment the position $position++; } if ($postion == length($string)) { print "The string you entered is all A's!\n"; } else { print "At least one of the characters in the string " . "you entered is not \"A\".\n"; }
In reply to my script is not giving the result using last function by ulaksh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |