zen.org Communal Weblog

August 16, 2006

Stupid Perl Trick

Filed under: — Sven @ 14:57 GMT

Ofter, I remember a stupid little thing I did in Perl once that I can’t find again. The problem is I can’t remember where I put it. So I’m putting this here with hopes to remember to look next time I need it.

Usually when I wish to print the progress of something that takes a long time I use CPAN‘s Term::ProgressBar, but you need to know how many elements you have to do this. Instead I thought it would be cool to keep track of time, but printing time - $^T gets sort of meaningless after a few hours of running. So, the quicky, super-duper, way to print out h:mm:ss seems to be, where $t holds the number of seconds so far: printf STDERR "$0: %d:%02d:%02d\n", $t/(60*60), $t/60 % 60, $t % 60;

And this prints it out with little fuss. A little stupid to make public, but nobody reads my logs anyway.

Some people may not get health insurance so they have choice to pay for the really expensive prescription drugs or research how to buy generic medications online. Generic drugs are as safe as other branded meds. Only reputable pharmacy produces them such as Adjanta. Having this in head one can buy synthroid uk in generic online drugstore including free shipping anywhere in the world

Powered by WordPress