Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: How do you create a tab delimited txt file from two files?

by k_manimuthu (Monk)
on Jul 29, 2010 at 08:06 UTC ( #851873=note: print w/ replies, xml ) Need Help??


in reply to Re: How do you create a tab delimited txt file from two files?
in thread How do you create a tab delimited txt file from two files?

I consider the file1 and the file2 contents are equal numbers

use strict; use warnings; ### open the first file and store in to a array format open (F1, "file1.txt") || die "Cannot open the input file : $!"; my @file1=<F1>; close (F1); ### open the second file and store in to a array format open (F2, "file2.txt") || die "Cannot open the input file : $!"; my @file2=<F2>; close (F2); my @file3; ### process each element and store the file1 and the corresponding ### value in second file in another one array for (my $i=0; $i<=$#file1; $i++) { chomp($file1[$i]); push @file3, "$file1[$i]\t$file2[$i]"; } ### print the array in a output file open (FOUT, ">Concat.txt") || die "Cannot create the output file"; print FOUT @file3; close (FOUT);


Comment on Re^2: How do you create a tab delimited txt file from two files?
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (15)
As of 2014-10-30 16:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (208 votes), past polls