in reply to Wht is my .txt file full of garbage? And why does this flock cause a compilation error?

Okay ... here is my shot at it ...

  1. With regard to the flock(FH, LOCK_EX) statement, are you exporting the constants for LOCK_EX from Fcntl? (eg. use Fcntl qw/:DEFAULT/;) If not, then you will have to use the corresponding values for these constants, rather than their name. eg. flock FH, 8 instead of flock FH, LOCK_EX
  2. As for the 'junk' ending up in your text file, my best guess on this is because you are using the " quote for your print statements which will result in the arguments to be interpolated and thus, rather than <TR> <TD> being printed to the file, the interpolated contents of the (non-existent) file handles TR and TD are printed. To correct this, change your "'s to use the non-interpolated quotes '.

Update - Apparently brackets are not interpolated within double-quotes .. Thanks for the save chipmunk :)

 

Ooohhh, Rob no beer function well without!

  • Comment on Re: Wht is my .txt file full of garbage? And why does this flock cause a compilation error?
  • Select or Download Code

Replies are listed 'Best First'.
Re: Re: Wht is my .txt file full of garbage? And why does this flock cause a compilation error?
by jerrygarciuh (Curate) on Nov 14, 2001 at 07:05 UTC
    Rather than rewriting the whole thing so the variables still get interpolated, can I just have lines like this:
    print FH  '<TR> <TD>'.$words.'<p> </TD> </TR><P>\n';
    TIA
    jg
    _____________________________________________________
    My name is Inigo Montoya...