Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Wht is my .txt file full of garbage? And why does this flock cause a compilation error?

by rchiav (Deacon)
on Nov 14, 2001 at 06:59 UTC ( #125217=note: print w/replies, xml ) Need Help??


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

I'd guess that rob_au is correct about importing the constants. Read flock to see how to import the constants.

As for the garbage in the file.. there's one thing that I see that could be causing it. When you read in the data, where's the file pointer? You then truncate the file. I'm not positive, but I think your pointer is beyond the end of the file.

Before you truncate it, do a

seek FH, 0, 0;
I did a quick test and without the seek, I couldn't see anything in the file. When I used seek, everything printed fine.

Hope this helps..
Rich

  • Comment on Re: Wht is my .txt file full of garbage? And why does this flock cause a compilation error?
  • 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:25 UTC
    Thanks!! The seek did the trick!
    TIA
    jg
    _____________________________________________________
    My name is Inigo Montoya...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://125217]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (1)
As of 2021-09-26 12:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?