in reply to Trying to Create and Write to a file

open (CREATE,">>pancho.conf"); print CREATE "[Global]"; close (CREATE);

Could be anything. You're not checking the return values of these file related functions.

Remember:
open or die
print or die
close or die

This goes for many other functions as well.

open CREATE, '>>pancho.conf' or die $!; print CREATE '[Global]' or die $!; close CREATE or die $!;

You probably should be more verbose than just $!, but don't forget to include $!, since it contains the actual error message.

That said, you should learn Perl. Try reading a book.

Juerd
- http://juerd.nl/
- spamcollector_perlmonks@juerd.nl (do not use).

Replies are listed 'Best First'.
Re: Re: Trying to Create and Write to a file
by Nkuvu (Priest) on Apr 07, 2003 at 19:07 UTC

    I have to offer apologies -- I originally was going to vote this note up based on the checking of errors. Then reconsidered based on the last line, and missed the null vote.

    So my vote should have been null, and I actually voted --.

      So my vote should have been null, and I actually voted --.

      No need to apologize. Votes are anonymous, and I couldn't care much less ;) One wrong vote won't hurt anyone.

      Juerd
      - http://juerd.nl/
      - spamcollector_perlmonks@juerd.nl (do not use).