Skip to content

Instantly share code, notes, and snippets.

@easternnl
Created November 15, 2019 09:10
Show Gist options
  • Save easternnl/9b0c1d3cef6f2938ca6eb1e72741adf5 to your computer and use it in GitHub Desktop.
Save easternnl/9b0c1d3cef6f2938ca6eb1e72741adf5 to your computer and use it in GitHub Desktop.
A timeout/pause function which will display how long the user needs to wait before the script continues
#!/usr/bin/perl
$| = 1; # flush everything directly to the output buffer
timeout(10);
sub timeout
{
my $wait = shift;
for (my $i=$wait; $i > -1; $i--)
{
print STDOUT "\rWaiting for $wait seconds, $i to go ";
sleep(1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment