in reply to Re^2: do until loop breaks before meeting the condition
in thread do until loop breaks before meeting the condition

Works for me. It keeps asking until I enter "end" or "END" (or "eNd" etc.).
#!/usr/bin/perl use warnings; use strict; use constant MAXBYTES => 5; $| = 1; MSG: print "Please be aware maximum length ${\MAXBYTES} characters!:\n +"; my $result; do { print "Send this text to clients:\n\n"; chomp ($result = <STDIN>); if (length($result) >= MAXBYTES) { print "\nYou have reached the limit of characters ", length $result, "!\n\n"; goto MSG } } until uc $result eq "END";
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^4: do until loop breaks before meeting the condition
by thanos1983 (Parson) on Jun 08, 2014 at 14:57 UTC

    To: choroba,

    Thank you for your time and effort.

    It works fine as long as the user enters more than 5 characters, if the user enters less than 5 still the loop breaks. I can not understand this part why it breaks?

    Update

    After carefully observing my mistake, I found out that I was still applying until ($result eq "END" || "end");.

    Your example was absolutely fine, my mistake.

    Again thank you for your time and effort

    Seeking for Perl wisdom...on the process...not there...yet!
      The loop doesn't break for me for short inputs. Are you sure you copied and pasted exactly the code I posted?
      لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

        To: choroba,

        You are right, I did not pay attention to the detail that you where pointing out:

        until uc $result eq "END";

        Based on this modification works just fine.

        Thank you for your time and effort assisting with my problem.

        Seeking for Perl wisdom...on the process...not there...yet!