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

You could also look at the Tie::File module, which allows you to access a file as an array. Here is some sample code:

#!perl use strict; use warnings; use feature qw(:5.10); use Tie::File; tie my @file1, 'Tie::File', 'file1' or die "Cannot tie file1: $!"; tie my @file2, 'Tie::File', 'file2' or die "Cannot tie file2: $!"; foreach(0 .. $#file1){ say "$file1[$_]\t$file2[$_]"; } untie @file1; untie @file2;

You may have to do some error checking if you expect the files to be different lengths.

Update: Link fixed.

Replies are listed 'Best First'.
Re^2: How do you create a tab delimited txt file from two files?
by elef (Friar) on Jul 30, 2010 at 18:44 UTC
    Thanks for that one, I'll keep it in mind. It seems that, despite what one might assume, Tie::File is part of the standard perl distribution and it doesn't read the whole file into memory. It should be come in pretty handy.