in reply to read an integer from a file

use strict; use warnings;
Please always check that you can open the file. Then you should chomp:
open (MYFILE, "status2.txt") or die "Unable to open status2.txt: $!"; my $a = <MYFILE>; chomp $a;

Replies are listed 'Best First'.
Re^2: read an integer from a file
by almut (Canon) on Jun 15, 2010 at 11:43 UTC
    Then you should chomp

    == should work without chomping (while $a eq "0" would not):

    my $a = "0\n"; print "is zero\n" if $a == 0;