in reply to Re: in search of a more elegant if then else
in thread in search of a more elegant if then else

And with 5.10 there is given/when

given ( $n ) { when ( 1 ) { $s = 'one'; } when ( 2 ) { $s = 'twe'; } when ( 3 ) { $s = 'three'; } when ( 4 ) { $s = 'four'; } default { $s = 'ETOOBIG'; } }

- doug

Replies are listed 'Best First'.
Re^3: in search of a more elegant if then else
by Anonymous Monk on Jan 16, 2011 at 22:31 UTC
    i should read the changes more, i love this! so simple and easy to understand.