App-pl
view release on metacpan or search on metacpan
pod/examples.pod view on Meta::CPAN
Likewise for overall maximum, you start with negative infinity:
pl -aB '$RESULT = "-inf"' '$RESULT = max $RESULT, @FIELD' file*
pl -aB '$R = "-inf"' '$R = max $R, @FIELD' file*
=item Median, Quartiles, Percentiles
The median is the number where half the list is less and half is greater.
Similarly the 1st quartile is where 25% are less and the 3rd where 25% are
greater. Use a list slice to extract these 3 and a 97th percentile, by
multiplying the fractional percentage with the list length:
pl -A 0..200 'echo @ARGV[map $_*@ARGV, .25, .5, .75, .97]'
pl -A 0..200 'e @A[map $_*@A, .25, .5, .75, .97]'
> 50 100 150 194
If you'd rather have names associated, assign them to hash slice in
sort-numerically-at-end C<%N(UMBER)>, whose key order must match the
percentages:
pl -A 0..200 '@NUMBER{qw(lower median upper 97.)} = @ARGV[map $_*@ARGV, .25, .5, .75, .97]'
pl -A 0..200 '@N{qw(lower median upper 97.)} = @A[map $_*@A, .25, .5, .75, .97]'
> 50: lower
> 100: median
> 150: upper
> 194: 97.
=item Triangular Number, Factorial and Averages
( run in 0.369 second using v1.01-cache-2.11-cpan-05162d3a2b1 )