Are you trying to confuse yourself?
open(INPUT, "data.txt") || die "Error opening 'keywd.txt'\n";
^^^^----------- wtf? -------------^^^^^
Same here. You use 3 argument open here, you should do the same in the previous open, just to be consistent:
open(FH, '<', "keywd.txt") || die "Error opening 'data.txt'\n";
but you'd better write it like with $!
open(FH, '<', "keyword.txt") || die "Error opening 'keyword.txt': $!\n
+";
^^-- sic! error message in here -----------^^
to get the error (No such file, permission denied, ...) along.
You can chomp an entire array
chomp(my @data = <INPUT>);
and avoid the chomp($element) further down.
And you do a chomp on $element, but not on the contents of the @keywd array. So, your $element never matches e.g. analysis\n. <update> You require there be a newline in $element - but there isn't one, 'twas chomped off. </update>The other way round there would have been a match.
BTW, your code formatting is pretty messy..
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|