http://www.perlmonks.org?node_id=1082925


in reply to The 'eval "require $module; 1"' idiom

As plenty of monks have pointed out, in the context of a conditional the ;1 isn't needed.

In other contexts, consider:

my $MODULE_WAS_LOADED = eval "require 'bar.pl'"; print "Debug: MODULE_WAS_LOADED=$MODULE_WAS_LOADED\n";

And in bar.pl:

# ... module code here ... "For some reason this module has chosen to make its return value some ridiculously long value; perhaps the original author simply forgot to add the usual 1; at the end of the module and this return value is simply whatever the last statement in the module evaluates to. Whatever the case, I'd prefer it not polluting my debug output." #EOF