open FILE, $somefile or die "Could not read $somefile, perl says the error is $!\n"; # note if you want to use || rather than or you need to be aware # that it binds tighter than the , operator so you need parnes thusly open (FILE, ">$somefile") || die "Could not write $somefile, $!\n";