ulaksh has asked for the wisdom of the Perl Monks concerning the following question:
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"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: my script is not giving the result using last function
by marto (Cardinal) on Aug 28, 2012 at 12:47 UTC | |
|
Re: my script is not giving the result using last function
by Corion (Patriarch) on Aug 28, 2012 at 12:42 UTC | |
|
Re: my script is not giving the result using last function
by Anonymous Monk on Aug 28, 2012 at 12:41 UTC | |
|
Re: my script is not giving the result using last function
by philiprbrenan (Monk) on Aug 28, 2012 at 12:58 UTC | |
by Anonymous Monk on Aug 28, 2012 at 12:59 UTC |