my $file_name; if (-e ($file_name = "1\.txt") or -e ($file_name = "2\.txt")){ $fh->new IO::File "<$file_name" or die $!; }