in reply to How to use Labels
Apart from the technical issue, the algorithm is just asking for trouble. Take a look at a 'naked block' and use redo. Put a # of tries limit on your loop:
my ($tries, $success) = (0, 0); { last if ++$tries > 10; print "Flocking file: attempt # $tries ... \n"; # attempts to flock file, prints a warning if that fails # warning -- the following relies on operator # precedence (&& binds tighter than or -- # use parens if that might confuse you) flock(FILE, 2) or warn "Can't flock file: $!\n" && redo; # rest of stuff $success =1; } die "Gave up after", --$tries, " attempts." unless $success;
HTH
perl -e 'print "How sweet does a rose smell? "; chomp ($n = <STDIN>); +$rose = "smells sweet to degree $n"; *other_name = *rose; print "$oth +er_name\n"'
|
---|
Replies are listed 'Best First'. | |
---|---|
(tye)Re: How to use Labels
by tye (Sage) on Jun 20, 2001 at 02:44 UTC |