in reply to readline() on unopened filehandle

You're still not checking open for failure, why?

Replies are listed 'Best First'.
Re^2: readline() on unopened filehandle
by Anonymous Monk on Oct 07, 2005 at 13:34 UTC
    Because I very rarely program in Perl.

      No mater what the language you should always check the return value from system and library calls.

        Perhaps he means that if you don't code often in Perl, all your opens will succeed. ;-)
        Perl --((8:>*
        This code hangs up after the bit that prints 'I am here'. When I say 'hangs up' I mean it just keeps on running without finishing the program. I just want it to run the SPROC $FH.
        while (<*.sql>) { next if $_ eq 'Activate.sql'; $file = $_; open (FILE, "$file"); my $line_number = 0; my $run; LINE: while (<FILE>){ my $line = $_; $line_number = $line_number +1; $run = 1; if ($line_number == 1){ $run = 0 if $line !~ m/^ALTER\sPROCEDURE\s/; last LINE; } else { $run = 1; } last LINE; } if ($run == 1){ push (@files, $file); } else { #Do nothing } } print "@files"; foreach (@files) { my $FH = $_; open (FILE, "<$FH"); OUTER: while ((<FILE>)) { my $line_B = $_; print "\n\nI am here\n"; last if eof; my $batch; do { $batch .= $line_B; } until ($line_B =~ m/^\s*go\s*$/i); $dbh->do($batch) if ($line_B =~ m/^\s*go\s*$/i); last if ($line_B =~ m/^\s*go\s*$/i); } }