in reply to Conditional module use

Try

Term::ReadKey::ReadMode(2); ... Term::ReadKey::ReadMode(0);

The parens help Perl disambiguate subroutine call vs. method invocation.

Replies are listed 'Best First'.
Re^2: Conditional module use
by Nkuvu (Priest) on Apr 21, 2006 at 21:18 UTC

    That works perfectly, thank you.

    But I'm a little unclear on the reason. What's the difference between a subroutine and a method in Perl?

      I don't know what gaal was thinking, but that's not it. The problem is that Term::ReadKey::ReadMode in Term::ReadKey::ReadMode 2; is a bareword unless you load Term::ReadKey. With strict enabled, Perl gives a warning instead of trying to disambiguate what you meant.

      For this reason, a lot of people recommend always using parentheses around all subroutine and method call arguments.