in reply to "use 5.10.0" creates weird syntax error on sub named "default"

Switch statements (given / when) use the new default keyword.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Replies are listed 'Best First'.
Re^2: "use 5.10.0" creates weird syntax error on sub named "default"
by aixtal (Sexton) on Nov 27, 2010 at 09:34 UTC

    That must be it ! Thanks, Alexander.

    I thought of that feature active only with use Switch 'Perl6'; (http://perldoc.perl.org/5.10.0/Switch.html), but the keyword is obviously reserved all the time.

    Still not clear to me why writing explictly use 5.10.0 change the rules of the game, since I'm running 5.10.0 anyway, but allright...

    Many thanks again !

      I thought of that feature active only with use Switch 'Perl6';

      The experimental Switch module has nothing to do with the built-in switch statement Perl introduced in 5.10.

      but the keyword is obviously reserved all the time.

      Not so. That would have broken backwards compatibility. It's only reserved when use feature qw( switch ); is in use, which is done by use 5.10.0; for you (since you're obviously not worried about backwards compatibility).