auxpartition.pl 567 B

123456789101112131415161718192021222324252627282930
  1. #!/usr/bin/perl
  2. my($auxparts,@partpoint)=@ARGV;
  3. if($#partpoint<0){
  4. &usage;
  5. }
  6. while (<STDIN>) {
  7. my@nums = ();
  8. @nums = split(/,/);
  9. my$cols=$#nums;
  10. my$j,$i=0;
  11. for(;$j<=$#partpoint;$j++){
  12. for(;$i<$partpoint[$j] && $i<$cols;$i++){
  13. print $nums[$i]+($j*$auxparts).", ";
  14. }
  15. }
  16. for(;$i<$cols;$i++){
  17. print $nums[$i]+($j*$auxparts).", ";
  18. }
  19. print "\n";
  20. }
  21. sub usage{
  22. print "\nOggVorbis auxbook spectral partitioner\n\n";
  23. print "auxpartition.pl <entries> <partitionpoint> [<partitionpoint>...]\n\n";
  24. exit(1);
  25. }