in reply to Win32::daemon and Perl

open (OUT, ">>C:\perl\scripts\out.txt");

When you use double quotes, you also need double backslashes

">>C:\\perl\\scripts\\out.txt"

Alternatively, use single quotes

'>>C:\perl\scripts\out.txt'

Also, with most IO, it's a good idea to do some error handling, e.g.

open (OUT, '>>C:\perl\scripts\out.txt') or die "...some informative me +ssage...: $!";

(I'm not sure whether it's best to die in this case... this is just an example — modify as appropriate.)

Replies are listed 'Best First'.
Re^2: Win32::daemon and Perl
by afoken (Chancellor) on Jun 04, 2009 at 10:07 UTC

    One could also use forward slashes. DOS and Windows really don't care if the slash is forward or backward. Only some legacy programs assume that filenames can't contain forward slashes, and explicitly check for them instead of just passing them to the API functions.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
      One could also use forward slashes.

      That's right.  It's even better actually, because in contrast to using single quotes and backslashes, you don't need to remember to take care of the special case when you have a path with a trailing separator, e.g.

      my $dir = 'c:\perl\scripts\'; # wrong my $dir = 'c:\perl\scripts\\'; # ok when last backslash is escaped vs. my $dir = 'c:/perl/scripts/'; # ok my $dir = "c:/perl/scripts/"; # ok