use Tie::Cycle; my $delay=100; tie my $spinner, 'Tie::Cycle', [map {("\b$_") x $delay} qw(\ | / -)];