-
The first time, $previoustime is undefined (warning from "line 15"), hence ($time - $previoustime >= 10) is true and the rest of the or is ignored (first "line 22" warning), because the loop condition is true anyway.
-
Second time the condition is evaluated: Since in the previous iteration the condition was true without sleep, the time assignment happened within the same second as the previous one, resulting in a sleep 10
-
Third time: After the sleep, time has advanced by 10 seconds, ($time - $previoustime >= 10) being true again, same situation as in first iteration, i.e. no sleep.
-
Fourth iteration is just like the second
The sleep is not evaluated (hence, not executed) every odd iteration because of the "short-circuit" nature of perl's boolean operators.
davido explains this thoroughly in
Perl Idioms Explained - && and || "Short Circuit" operators - despite the subject, this is also regarding
and and
or.