Isaac's Perl Spinner

my $cur_key = 0; sub spinner() { my @chars = ("-", "\\", "|", "/"); my $backsp = "\b"; my $spinner_lag = $_[0] if $_[0]; if ($cur_key == @chars) { $cur_key = 0; } if ($spinner_lag) { my $i; if ($i == $spinner_lag) { print $backsp . $chars[$cur_key]; $i = 1; } else { $i++; } } else { print $backsp . $chars[$cur_key]; } $cur_key++; }
Leave A Reply
All content licensed under the Creative Commons License