App-matrixpack

 view release on metacpan or  search on metacpan

scripts/matrixpack  view on Meta::CPAN

#!/usr/bin/perl
use 5.014 ; use strict ; use warnings ; 
use Getopt::Std ; getopts '1ah/:' , \my%o ; 
use Term::ANSIColor qw[:constants] ; $Term::ANSIColor::AUTORESET =  1 ;
use Scalar::Util qw[looks_like_number] ; 
use FindBin qw[$Script] ; 
BEGIN{
print STDERR BRIGHT_RED qq["$ARGV[0]" may be given as a file although it should consist of column numbers.\n] if -f $ARGV[0] ;
}
my @cols = split /[,\n\t]/, shift @ARGV , 0 ; # 指定された列が @cols に格納される。
do { print STDERR BRIGHT_RED "[$Script] Numbers is not specified: @cols\n" ; exit 1 } if grep {! looks_like_number $_ } @cols ;
do { print STDERR BRIGHT_RED "[$Script] Only 0 is specified: @cols\n" ; exit 1 } unless grep { $_ != 0} @cols ;

my $sep = $o{'/'} // "\t" ; 
my @ca = @cols ; # @colsが作業用に格納され、処理中に使われる。
do{ select STDERR ; &HELP_MESSAGE } unless @cols ; 
$o{h} ? & takehead : & packing ; 
do { print "\n" for @ca } if $o{a} ; 
exit 0 ; 

sub takehead { 



( run in 0.356 second using v1.01-cache-2.11-cpan-64827b87656 )