in reply to next unless not working
You used = not eq which is what you want checking for string equality (had you wanted numeric equality it'd still be == instead). If you'd used the warnings pragma like is recommended you'd have gotten a message to this effect.
Found = in conditional, should be == at foo.pl line 9.
Edit: I missed the other problem which is that you're iterating over <> which will read from stdin (which is why it's just sitting there waiting for you to type at it); to read from the file you opened you should use the name of the filehandle <FD>. Again warnings would have griped that you hadn't used FD.
And another thing: Your last line should also use the name of the filehandle to let perl know what you want to close:
close( FD ) or warn qq{Problem closing FH: $!\n};And again: Get in the habit of using $! in your error messages. You're checking that the open failed but your text is lacking. Including both the path you're trying to operate on as well as $! to indicate WHAT went wrong will save yourself headaches down the road.
The cake is a lie.
The cake is a lie.
The cake is a lie.
|
|---|