in reply to Re^5: Switch.pm Failure
in thread Switch.pm Failure

"The only way that this Switch { ... } block would make sense is if somewhere there was a sub Switch (&);

wow, but even then i would have done Switch sub {...} just like i say my $n=scalar(@ar);, im not into golf

Replies are listed 'Best First'.
Re^7: Switch.pm Failure
by haukex (Archbishop) on Feb 25, 2017 at 20:59 UTC
    i would have done Switch sub {...}

    Ok, but without the sub is also not uncommon, for example I'd say Try::Tiny's sub try (&;@) clearly looks better when written try { ... } catch { ... };.

    In regards to your other post:

    the whole (logical-test) && do { process-stmts} ; setup while legal is very "un-perlish"

    I disagree, I think it's very perlish, in fact probably "too" perlish! ;-)

    given/when

    Note that these were retroactively marked experimental as of v5.16, and will generate warnings in Perl v5.18 and above:

    It is clear that smartmatch is almost certainly either going to change or go away in the future. Relying on its current behavior is not recommended.