User Tools

Site Tools


old:programmieren:perl:slowcat

Langsame Ausgabe auf der Console

#!/usr/bin/perl
# slowcat - emulate a   s l o w   line printer
# usage: slowcat [-DELAY] [files ...]
$DELAY = ($ARGV[0] =~ /^-([.\d]+)/) ? (shift, $1) : 1;
$| = 1;
while (<>) {
    for (split(//)) {
        print;
        select(undef,undef,undef, 0.005 * $DELAY);
    }
}
cat <File> | perl -e '$|=1;while(<>){for(split(//)){print;select(undef,undef,undef,0.01);}}'
old/programmieren/perl/slowcat.txt · Last modified: 2023/01/11 20:29 by 127.0.0.1

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki