sugarboy has asked for the wisdom of the Perl Monks concerning the following question:

Hi All,

I am trying run a perl file using do which is as follows:
do ($script);
$script will be as /home/sagar/scripts/CLI/test.pl
The do statement returns the error : Bad File descriptor
The respective file exists at the specified location
Actually this works fine on previous setup with Perl 5.8.5, when i had a new setup with 5.8.8 it started showing up problems
Any help is appreciated

Thanks,
Sagar
  • Comment on Bad file descriptor error when tried to run script using do

Replies are listed 'Best First'.
Re: Bad file descriptor error when tried to run script using do
by ikegami (Patriarch) on Aug 05, 2010 at 19:45 UTC
    I don't know do to emit any error messages, so I find it hard to believe do has anything to do with the problem at hand.
    $ perl -e'do "nonexistent"' $
Re: Bad file descriptor error when tried to run script using do ($!)
by tye (Sage) on Aug 06, 2010 at 05:09 UTC

    This is a guess, but it seems very likely to be relevant: Don't print out the value of $! except very soon after a function has failed (and then only for functions that are documented to set $! on failure). You should not examine $! to try to determine if something failed. The function tells you that it failed (usually by returning a false value) and only after that you record $! to get a better idea as to why it failed. $! frequently gets set by mundane operations under the covers. Almost no functions reset $! if nothing failed.

    Next time, you might want to actually paste even a couple of lines of the actual code that you are having a problem with. Less guessing often means faster relevant answers.

    - tye