use IO::File; if (-e $file && open (my $AFILE = IO::File->new(), "<$file")) { ...