in reply to Re: perl daemon
in thread perl daemon

mr.nick: shouldn't
while (1) { if (-f $fn) { ## a file was found, do something DoSomething(); ## then exit exit; } ## pause 5 minutes before checking again sleep 300; }

really be:

while (1) { if (-f $fn) { ## a file was found, do something DoSomething(); ## then break the loop break; ## <<-- not exit(); } ## pause 5 minutes before checking again sleep 300; }

Replies are listed 'Best First'.
Re: Re: Re: perl daemon
by Fastolfe (Vicar) on Feb 08, 2001 at 22:28 UTC
    exit is fine here: it exits the program. There is no 'break' in Perl, but there is a last, which does the same thing. I would have used 'last' myself as well, but 'exit' works fine.