in reply to Remove lowest number

You want to remove the lowest number from @all? And you've already sorted it in descending numerical order.

pop @all;
--
<http://www.dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg

Replies are listed 'Best First'.
2Re: Remove lowest number
by jeffa (Bishop) on Aug 06, 2003 at 15:32 UTC
    And then to sum up the rest ...
    use List::Util qw(sum); my $sum = sum(@all);
    Update: or just drop the pop and dice up a slice:
    my $sum = sum( @all[0 .. $#all-1] );

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    
Re: Re: Remove lowest number
by ellem (Hermit) on Aug 06, 2003 at 15:40 UTC
    I appreciate the answer. You obviously know Perl really well. Me; not so good. So what would I ask perldocs to get to pop (which I am now looking up in perldocs)?

    To clarify, how would I phrase my question in perldocs to get perldocs to tell me about pop without me mentioning pop?
    --
    ellem@optonline.net
    There's more than one way to do it, but only some of them actually work.
      pop is a built-in function. You can find docs on these funtions with the -f option:
      perldoc -f pop

      jeffa

      L-LL-L--L-LL-L--L-LL-L--
      -R--R-RR-R--R-RR-R--R-RR
      B--B--B--B--B--B--B--B--
      H---H---H---H---H---H---
      (the triplet paradiddle with high-hat)
      
      perldoc -f pop