my $msg; try { open (FILE, "strangefilename") || die "$!"; $msg = ; } catch { print "File could not be opened because of: $@\n"; $msg = "BAAAAH"; }