in reply to foreach problem?

What's going haywire :
foreach ($currentword, @words)
Why's it giving unexpected results :
because you have what you'd like to be your control variable, $currentword in the parens, which denote the list foreach will loop through. This means that your control variable is really becoming the first element of the array, and $_ steps into the place you think $currentword is taking. Since $currentword is empty when the foreach starts, you (naturally?) get "" as the first element. If you'd like to test this out, change my $currentword to my $currentword="First Element!" and see what happens.

What to do:
foreach $currentword ( @words) { ... ... ... }
This restores $currentword to its rightful throne as control variable.
actually, if you're only using $currentword in this loop, I'd recommend declaring in the loop :
foreach my $currentword ( @words)