Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: HOW to calculate the column data

by ikegami (Patriarch)
on Dec 03, 2009 at 21:04 UTC ( [id://810946]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my %vals_by_type;
    while (<DATA>) {
    ...
        my ($type, $val) = split ' ';
        push @{ $vals_by_type{$type} }, $val;
    }
    
  2. or download this
    use List::Util qw( sum );
    
    ...
        my $avg = sum( map $_/@$vals, @$vals );
        printf("%s %.2f\n", $type, $avg);
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://810946]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-04-20 06:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found