in reply to Re: syntax error near print
in thread syntax error near print

I added semicolon at prevoius line as you suggested but now there is a new error message: Parsing BLAST results Cannot open 429F04: Permesso negato at blast.parsing.pl line 24. 429F04 is the output name, just as example... thanks again for your suggestion

Replies are listed 'Best First'.
Re^3: syntax error near print
by marto (Cardinal) on Jul 24, 2012 at 10:55 UTC

    I guess this is a 'permission denied' message, in Italian. Ensure that the value you have for $outfile is what you think it should be and that you can create this file manually. If you have permissions issues check with your sysadmin, perhaps you don't have access to write files to the directory in question.

      I created the outfile with sudo command. So I'm sure the 429F04 file is present in /usr/bin....

        Are you sure you want to put data files in to /usr/bin? See http://www.linfo.org/usr_bin.html. Consider running this script in your home directory (or a sensibly named sub directory of your home directory).

        As you've discovered you can't create files in directory in which you don't have permissions without using sudo, so unless you run your perl script in the same manner, this isn't going to work. I advise against creating these files in /usr/bin anyway. Please consider my suggestion above.

      Martoooo!!! My problems are not finished!!! :-( While the script was running I see this error: print() on unopened filehandle OUTFILE at blast.parsing.pl line 53, <GEN1> line 3985842. print() on unopened filehandle OUTFILE at blast.parsing.pl line 55, <GEN1> line 3985842. and I realized that in the output is loosed the "accession number" column... Is there a solution?

        In a couple of places you have:

        print OUTFILE "\t" if ($count > 0);

        When you don't have a file handle called OUTFILE. Previously in your code you have:

        open (OUT, ">$outfile" ) or die "Cannot open $outfile :$!";

        And print quite happily to it later in the code. If you are happy for the output to go to the existing file change the two occurrences of OUTFILE to OUT.