sub notfree { # returns true if license not free # whatever you do with parsing lmstat } LOOP: { if (notfree @args) { sleep $sane_interval; redo LOOP; } else { system( @other_args); } }