eval { main(); 1; } or do { # error handling with $@ }