develooper Front page | perl.perl5.porters | Postings from December 2017

Re: Revisiting smart match

Thread Previous | Thread Next
Rocco Caputo
December 19, 2017 14:39
Re: Revisiting smart match
Message ID:
> On Dec 19, 2017, at 08:50, Eirik Berg Hanssen <> wrote:
>   upon ($baz) { do_stuff(); }
>   do_stuff() upon $baz;
>   when ($_->foo eq 'bar') { do_stuff(); }
>   do_stuff() when $_->foo eq 'bar';

I missed something.  On the surface, the "when" form looks like it has the same syntax and semantics as plain old "if".  Why can't "if" be used in that case? (pun semi-intended)

It's an open question for anyone.  This example just happened to be the one that made me go "hmmm".

Rocco Caputo <>

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About