in reply to comparing columns and printing a result

Well, one of your first statements is
my $row = <$fh>;
Not only haven't you declared $fh yet, you haven't opened the file at this point. That's something you do later. But when you open the files, you're not checking whether this succeeds.
my (@col1,@col2); my @words = split(//,@col1);
What's the point of this? @col1 doesn't contain anything, so what you want to split? You're also declaring @col, but not using it.
@col2 =~ m/$words[$_](\d+)/
No idea what you want to do, but on the LHS of a =~ you have to have a scalar, not a list or array. Furthermore, since you never put anything in @words, there will be nothing to match here. And even then, $_ is the line you're reading from the file; it probably doesn't contain a number.

Replies are listed 'Best First'.
Re^2: comparing columns and printing a result
by slartsa (Initiate) on Jan 26, 2009 at 13:03 UTC
    Thank you for reply. col1 should be everything before column separator and I was seeking to split the words in col1 as array. I don't know if it's the best idea when trying to handle words one by one as search value but that's something I came up with in first place.