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


in reply to Re^3: Short and easy way to write if...elsif syntax
in thread Short and easy way to write if...elsif syntax

Given/When is syntactic sugar for if..elsif.

Replies are listed 'Best First'.
Re^5: Short and easy way to write if...elsif syntax
by Kenosis (Priest) on Aug 28, 2012 at 02:08 UTC

    Perhaps I'm misunderstanding what you're saying, but given is a topicalizer, aliasing a lexically scoped $_ to a scalar's value which when operates on. The if/elsif construct doesn't create topics. Given this difference in functionality, how is given/when syntactic sugar for if/elsif?