if (-r $filename) { #do stuff here with the file } else { carp "Cannot read file $filename\n"; }