Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^3: Take Data out from unknown number of files

by jwkrahn (Monsignor)
on Nov 10, 2008 at 09:42 UTC ( #722595=note: print w/replies, xml ) Need Help??

in reply to Re^2: Take Data out from unknown number of files
in thread Parse values from multiple files into one

UNTESTED, but perhaps something like this:

use List::Util 'sum'; my @su_files = glob "SU*"; my @mu_files = glob "MU*"; @ARGV = ( @su_files, @mu_files ); my %data; while ( <> ) { my ( $key, $number ) = split /\t/; push @{ $data{ $key }{ lc substr $ARGV, 0, 2 } }, $number; } print join( "\t", 'Header', @su_files, 'average', @mu_files, 'average' + ), "\n"; for my $key ( sort keys %data ) { my ( $su, $mu ) = @{ $data{ $key } }{ qw/ su mu / }; print join( "\t", $key, @$su, sum( @$su ) / @$su, @$mu, sum( @$mu +) / @$mu ), "\n"; }

Replies are listed 'Best First'.
Re^4: Take Data out from unknown number of files
by Anonymous Monk on Nov 10, 2008 at 10:05 UTC
    Thanks..Yeah this is what I want..But there are other things I need to do before..Can I take ur help if needed?!! Thanks a bunch!
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2022-01-20 02:47 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (56 votes). Check out past polls.