http://www.perlmonks.org?node_id=995709


in reply to EMPTY OUTPUT FILE GENERATED

Look closely at this line:

my @ra = map { ( split )[1] } split /\t/, @data1;

Start from the right hand side. The second argument to split needs to be a string of some sort, not an array.

Now move left.... Do you really intend to split on tabs, and then further split each tab-delimited column on a single space? (Because that's what's happening there.)

I suspect what you want is something more like this:

my @ra = map { (split /\t/, $_, 2)[0] } @data1

But I'm not positive, because I haven't seen your data. Next, why are you reading <FILE2> into @data2 without ever having called open on that filehandle? Also, you should be explicitly closing your output file, and using the or die construct again to verify that the close didn't fail.


Dave