I've been away from Perl for too long... I hope I'm not misunderstanding some fundamental principal here...
When I run this code from the command line, what I don't understand is how the "spinner" is printing over itself to the screen.
I understand that @sail is being interated through by incrementing $sail, but what part of this code is making the contents of @sail print on top of each other, i.e. making the "spinner" effect?
my @sails = map { "\b$_" } qw{- \ | /};
my $sail = 0;
{
local $| = 1;
print q{Running: };
for (0 .. 1000) {
system $cmd and die qq{'$cmd' failed! $? : $!};
print $sails[$sail++ % @sails] if not $_ % $skip;
}
}
Any help here? What am I overlooking?