in reply to Perl Newbie trying to figure out how to find out Median in my program

Here is a "one liner" for the median.

Use Single quotes if run on Linux.

perl -ne "chomp;last if $_ <0; push @val, $_}{@s=sort {$a<=>$b} @val;p +rint qq||,($s[$#s/2+0.1]+ $s[$#s/2+0.6])/2,qq|\n|"
See how to find median value for the calculation details.

If curious, lookup the Eskimo Greeting operator that is used here.

        ...Disinformation is not as good as datinformation.               Don't document the program; program the document.

  • Comment on Re: Perl Newbie trying to figure out how to find out Median in my program
  • Download Code

Replies are listed 'Best First'.
Re^2: Perl Newbie trying to figure out how to find out Median in my program
by Anonymous Monk on Apr 19, 2017 at 21:31 UTC
    If curious, lookup the Eskimo Greeting operator that is used here.
    That's wonderfully evil, and you should be ashamed of yourself for foisting it on a newbie.
            >> you should be ashamed of yourself

      Well - I am sporting a slight smirk ...

      In the absence of code from the OP, I figured I'd offer more of a learning opportunity ...

      That's my excuse, and I'm sticking to it.

              ...Disinformation is not as good as datinformation.               Don't document the program; program the document.