in reply to Can't quit my until loop

Your formatting and your {} block structure do not match. The last line of your until loop is chomp $answer. Remove the } from in front of the next if and all should be well again.

Update:You'll also need to add a closing brace after your else block. Suggested form:
until ($COND) { some($stuff); if ($THIS) { do($that); } else { do($anything); } }

Replies are listed 'Best First'.
Re: (ichimunki) Re: Can't quit my until loop
by ellem (Hermit) on Jul 03, 2001 at 20:16 UTC
    Got it! I had been moving things all over the place tyring to get it to work. It was the way I had setup the block. Thanks for your clearer explanation of the until construct.

    anylou... this works.
    #!/usr/bin/perl -w use strict ; use diagnostics; use LWP::Simple ; print "This will get the time from an NIST clock 5 times and then ask you if you want to continue. Use 'y' to continue and any other key to stop:\n\n" ; my $answer ; my $quit = 0 ; until ($quit) { getprint "http://132.163.4.101:13" ; getprint "http://132.163.4.101:13" ; getprint "http://132.163.4.101:13" ; getprint "http://132.163.4.101:13" ; getprint "http://132.163.4.101:13" ; print "\n\nDo you want to continue? " ; $answer = <STDIN> ; chomp $answer ; if ($answer eq 'y') { print "OK\n" ; } else { $quit = 1 ; } } print "Good-bye!\n\n" ;


    --
    lmoran@wtsgSPAM.com
    print "\x{263a}"
      You may still want to look at how you are using your braces relative to your indenting structure (see the addition to my note and the other comments). A good text editor like emacs (among others) will do a lot of this work for you.