Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: open input files once

by tybalt89 (Monsignor)
on Jul 14, 2020 at 19:11 UTC ( [id://11119315]=note: print w/replies, xml ) Need Help??


in reply to open input files once

Works for any number of files...

#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11119283 use warnings; @ARGV = <file*.tab>; # or just default from command line my $column = 0; my %key; while( <> ) { my @fields = split; $key{ join "\t", @fields[0 .. 3] }[$column] = $fields[6]; eof and ++$column; } for ( sort keys %key ) { print join( "\t", (split)[0 .. 2], '-', map $_ // 0, @{ $key{$_} }[ 0 .. $column - 1 ] ), "\n"; }

Log In?
Username:
Password:

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

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

    No recent polls found