Skip to content
Browse files

simplify hexout.pl to use wrap.pl's format

  • Loading branch information...
1 parent 5cd36ea commit 57389ecb2333f66b9ce7d99172f84c88c6f67efe @jlaire committed
Showing with 4 additions and 16 deletions.
  1. +4 −16 hexout.pl
View
20 hexout.pl
@@ -1,4 +1,5 @@
#!/usr/bin/perl
+use v5.12;
use warnings FATAL => 'all';
use strict;
@@ -28,24 +29,11 @@
my $s = $groove_size{$c};
for my $l (($full ? 1 : 2) .. 3) {
for (1 .. $s-$l+1) {
- my %ps = map { $p{$c . $_} => 1 } $_ .. $_+$l-1;
my $name = $c . join "", $_ .. $_+$l-1;
- $rows{$name} = join " ", map { $ps{$_} // 0 } @points;
+ $rows{$name} = [map $p{$c . $_}, $_ .. $_+$l-1];
}
}
}
-if ($mode eq 'gen') {
- print scalar(@points) . " 0 \n";
- print "$rows{$_}\n" for sort keys %rows;
-}
-elsif ($mode eq 'decode') {
- my @row_names = sort keys %rows;
- while (<STDIN>) {
- print join(" ", map $row_names[$_] // $_, grep /\S/, split /\s+/) . "\n";
- }
-}
-else {
- print "unknown mode: $mode\n";
- exit 1;
-}
+say join " ", @points;
+say join " ", $_, @{$rows{$_}} for keys %rows;

0 comments on commit 57389ec

Please sign in to comment.
Something went wrong with that request. Please try again.