while (my $line = <$fh>) { #### while (defined( my $line = readline($fh) )) { #### if (my $x = func()) { print "$x accesible here"; } elsif ($x eq 0) { # even here, print "and also here: $x"; }