in reply to Problems with open

Your code dies for me:

$ perl test.pl Can't exec "garbage": No such file or directory at test.pl line 6. Can't fork a garbage: No such file or directory at test.pl line 6.

I am running perl 5.6.1 on Debian Linux 3.0

Just a small adding to other monks' comments. Like other functions, print has a return value, too. So you shouldn't limit yourself at checking if open succeeds or fails: you should check print also, and take actions when it fails

Just my 2c/Euro
--bronto

# Another Perl edition of a song:
# The End, by The Beatles
END {
  $you->take($love) eq $you->made($love) ;
}

Replies are listed 'Best First'.
Re: Re: Problems with open
by skerr1 (Sexton) on Jul 24, 2002 at 16:22 UTC
    This appears to be an issue with Perl pre 5.6. I am running 5.005_2 on SunOS 5.6. With diagnostics on, I get:

    Can't exec "garbage": No such file or directory at foo.pl line 8 (#1) (W) An system(), exec(), or piped open call could not execute the +named program for the indicated reason. Typical reasons include: the pe +rmissions were wrong on the file, the file wasn't found in $ENV{PATH}, the executable in question was compiled for another architecture, or t +he #! line in a script points to an interpreter that can't be run for similar reasons. (Or maybe your system doesn't support #! at all. +)


    -sk