in reply to Re^2: Progress Bar in Perl script
in thread Progress Bar in Perl script

Each of the sails is created by prepending a "\b" to the spinner character:

my @sails = map { "\b$_" } qw{- \ | /};

"\b" is a backspace character; so, when each sail is printed, it deletes the previous one. In the initial state, "Running:" is followed by two spaces (print q{Running:  };); the second space is overwritten by the first sail.

"\b", and other special characters, are listed in perlop: Quote and Quote-like Operators.

-- Ken

Replies are listed 'Best First'.
Re^4: Progress Bar in Perl script
by regexes (Hermit) on Mar 13, 2013 at 15:17 UTC
    D'oh! Thanks! I knew I was overlooking something...