#!/usr/bin/perl use strict; use warnings; $|=1; # turns off stdout buffering mysleep(10); sub mysleep { my $seconds = shift; print "Sleeping for $seconds seconds ... "; for my $second (1..$seconds) { sleep(1); print " $second"; } print " done!\n"; }