What happens if the eval block returns false?
This false value is returned by eval .
Why is this required?
This is not required.
my $foo = eval { foo() };
great if you're ok with $foo being undef on exception.
What you saw
if (!eval { foo(); 1 }) { ... }
The code returns true so that if knows that eval succeeds. eval will return false for an exception.
source share