sub timetill($;$) { my $pipe = $|;#pipe value is saved $| = 1;#pipe value changed to flush the buffer my $time = shift || return -1;#how long my $line = shift || " seconds until event";#what chomp $time; chomp $line; my $backcount = length $line; $backcount+=7;#this is where you might need to edit #to suit you. Spaces, and number display is added #to the total count to backup while($time > 0) { print " " . ' ' x (3 - length($time)) . "$time $line"; foreach (1..$backcount){print "\b"} $time -= 1; sleep 1; } $| = $pipe;#yea maybe I don't need to replace $| #but I sleep better knowing I'd put #everyting back the way I found it. #I tend to use it like this: #timetill(10, 'edit /etc/inetd.conf'); #system("vi /etc/inetd.conf"); }
In reply to Time until event by halxd2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |