shortf.pl 743 B

123456789101112131415161718192021222324252627282930
  1. #! /usr/bin/perl
  2. ## vim:set ts=4 sw=4 et: -*- coding: utf-8 -*-
  3. ##
  4. ##---------------------------------------------------------------------------##
  5. ##
  6. ## Author:
  7. ## Markus F.X.J. Oberhumer <markus@oberhumer.com>
  8. ##
  9. ## Description:
  10. ## Create short files for compression test
  11. ##
  12. ## Copyright (C) 1996-2015 Markus Franz Xaver Johannes Oberhumer
  13. ##
  14. ##---------------------------------------------------------------------------##
  15. $c = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  16. $c = "\x00\x01\x02";
  17. $c = "\x00";
  18. $x = $c x 1024;
  19. for $i (0 .. 50) {
  20. $name = sprintf("f%04d.dat",$i);
  21. open(OUTFILE,">$name") || die "$0: cannot open '$name': $!";
  22. binmode(OUTFILE);
  23. print OUTFILE substr($x,0,$i);
  24. close(OUTFILE);
  25. }
  26. exit(0);