Skip to content

Instantly share code, notes, and snippets.

@warewolf
Created June 19, 2013 02:51
Show Gist options
  • Select an option

  • Save warewolf/5811359 to your computer and use it in GitHub Desktop.

Select an option

Save warewolf/5811359 to your computer and use it in GitHub Desktop.
Stupid hacks: catl (cat loop) - repeatedly print something to STDOUT
#!/usr/bin/perl
$ARGV[0]="-"if($ARGV[0]eq"");open(F,$ARGV[0])||die$!;binmode(F);if($ARGV[0]=~
/^-$|^$/||$ARGV[0]){while(!eof(F)){read(F,$d,1024);$s.=$d}}select(STDOUT);$|=
1;while(1){if($ARGV[0]ne"-"){seek(F,0,0);while(!eof(F)){read(F,$s,1024);print
STDOUT$s;}}else{print STDOUT$s;}}close F;# catl v1.0, (C) [email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment