http://qs1969.pair.com?node_id=4943

Lets say you have a perl script sucking rows out of a database. You generally want to know that it's still running, instead of it sitting there, working it's butt off, and not printing anything while it performs some math or hashing or something. This whirleygig prints a character to stdout or stderr so you can see it working.
#!/usr/bin/perl $|=1;$WHIRLEY_COUNT=-1; #$whirley='-\|/';@whirley=split //,$whirley; #$whirley='.o0O0o';@whirley=split //,$whirley; #$whirley='1234567890';@whirley=split //,$whirley; #$whirley='';@whirley=split //,$whirley; $whirley=" ".pack(C,176).pack(C,177).pack(C,178).pack(C,219).pack(C,17 +8).pack(C,177). pack(C,176);@whirley=split //,$whirley; sub whirley { if ($WHIRLEY_COUNT+1==@whirley) { $WHIRLEY_COUNT=0; } else { $WHIRLEY_COUNT++; } return "@whirley[$WHIRLEY_COUNT]"; } while (1) { sleep 1; print STDERR "please wait : ".&whirley."\r"; }