in reply to Re^3: 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?

Well, that's better than what the original script does, but I'd prefer to have the end of the longer file in the output as well, paired with empty "cells".

I.e. either

bla[tab] bla[tab] bla[tab]

or

[tab]bla [tab]bla [tab]bla

Replies are listed 'Best First'.
Re^5: How do you create a tab delimited txt file from two files?
by Marshall (Canon) on Jul 29, 2010 at 12:47 UTC
    A slight mod to BrowserUk's code is what you need:
    #!/usr/bin/perl -w use strict; open ONE, '<', "one.txt" or die "First File: $!\n"; open TWO, '<', "two.txt" or die "Second File: $!\n"; until( eof( ONE ) and eof (TWO)) { my $one = <ONE>; my $two = <TWO>; $one ||= ""; $two ||= ""; chomp($one); chomp($two); print "$one\t$two\n"; } __END__ OUTPUT: a this is 0 file two ab dsf one.txt: a 0 ab dsf two.txt: this is file two
      Indeed that seems to be just what I was looking for, thanks.