Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

qedrakmar's scratchpad

by qedrakmar (Beadle)
on Jun 01, 2004 at 19:01 UTC ( #358400=scratchpad: print w/ replies, xml ) Need Help??

Making sure my terminal is still connected, I use this:
#!/usr/bin/perl use strict; use warnings; my $now = time; while (1) { $now = time; if (($now % 5) == 0) { system "date"; while (($now % 5) == 0) { $now = time; } } }
But that eats a lot of system resources for something so simple...
#!/usr/bin/perl use strict; use warnings; my $seconds = 5; while (1) { my $time = localtime(); print $time, "\n"; sleep $seconds; }
is a lot more elegant... Thanks, jwest! "Sleep" was the big thing I was missing...
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (15)
As of 2015-07-07 20:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls