package whirly; use overload ('""' => \&nextchar, fallback => 1); use strict; sub new { bless [ '|', '/', '-', '\\' ] } sub nextchar { push @{ $_[0] }, shift @{ $_[0] }; return $_[0][0]; } #### use whirly; $waiting = new whirly; until (file_downloaded()) { print $waiting; }