perlpadre

Padre giving an error message about a line that doesn't exist


I have this program that runs OK on Windows with "perl program.pl" in the command prompt or "perl program.pl file1.txt file2.txt".

use strict;
use warnings;

print "there were ",scalar(@ARGV), " arguments passed to this program\n";
if ( scalar(@ARGV) > 1 )
{
    print "First Argument: $ARGV[0]\n";
    print "Second Argument: $ARGV[1]\n";
}


sub process_file($)
{
        my $filename = shift;
        print "will process file $filename\n";
        #open(INPUT_FILE,"<$filename") || die("could not open $filename");     
}

Even after exiting and coming back into Padre, I get this dialog box when I go to run it (it will still run OK if I click the Yes button):

Warning X Line 31: Using a | char in open without a | at the beginning or end is usually a typo. Do you want to continue?

[YES] [NO]


Solution

  • I use or instead of || with open. As an aside, I have always been told that the three argument form of open is what should be used. I do know that Perl doesn't always reference the line that has the problem. Of course I am taking for granted that the commented out line is the line in question and you commented it out as a test?