in reply to Question about warn statement

Or do a do (and be careful about the scope):
open (FILE, '>', "temp") or do { warn "error message"; $x=1 };