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; #### perl -e 'print "How sweet does a rose smell? "; chomp ($n = ); $rose = "smells sweet to degree $n"; *other_name = *rose; print "$other_name\n"'