Next Trivial Utilities 48

lr option processing

        my %Opts =
          (''          => [qw(Xm Ym Xv Yv Xs Ys m b r)],
           mean        => [qw(Xm Ym)],
           'm'         => [qw(Xm Ym)],
           stddev      => [qw(Xs Ys)],
           's'         => [qw(Xs Ys)],
           sd          => [qw(Xs Ys)],
           dist        => [qw(Xm Ym Xs Ys)],
           line        => [qw(m b)],
           correlation => [qw(r)],
           corr        => [qw(r)],
           r           => [qw(r)],
           lr          => [qw(m b r)],
           variance    => [qw(Xv Yv)],
           var         => [qw(Xv Yv)],
           v           => [qw(Xv Yv)],
        );

        if (@ARGV) {
          while ($ARGV[0] =~ /^-(\w+)$/) {
            if ($Opts{$1}) {
              for my $s (@{$Opts{$1}}) {
                $V{$s} = 1;
              }
            } else {
              $V{$1} = 1;
            }
            shift;
          }
        } else {
          $V{$_} = 1 for @{$Opts{""}};
        }



Next Menu Copyright © 2012 M. J. Dominus