Glenn Linderman wrote: > For instance, > > if ( $v == @foo ) > > is clearly testing the size of foo against the value of $v. But > > switch ( $v ) { > case 1: { ... } > case 2: { ... } > case @foo { ... } > } > > does not! Then write the switch as: switch ( __ ) { case $v == 1: { ... } case $v == 2: { ... } case $v == @foo { ... } } It might take you a little while to get your head around the __ symbol. I'm not sure it's useful to think of it as a variable; poison is more like it. Or a Midas touch. Any expression it touches turns into a subroutine. All the case statement does is call the subroutine. - Ken
- Re: RFC 22 (v1) Builtin switch statement Damian Conway
- Re: RFC 22 (v1) Builtin switch statement Jonathan Scott Duff
- Re: RFC 22 (v1) Builtin switch statement Ted Ashton
- Re: RFC 22 (v1) Builtin switch statement John Porter
- Re: RFC 22 (v1) Builtin switch statement Graham Barr
- Re: RFC 22 (v1) Builtin switch statement Glenn Linderman
- Re: RFC 22 (v1) Builtin switch statement Damian Conway
- Re: RFC 22 (v1) Builtin switch statement Glenn Linderman
- Re: RFC 22 (v1) Builtin switch statement Ken Fox
- Re: RFC 22 (v1) Builtin switch statement Glenn Linderman
- Re: RFC 22 (v1) Builtin switch statem... Jeremy Howard
- Re: RFC 22 (v1) Builtin switch statem... Ken Fox
- Re: RFC 22 (v1) Builtin switch statem... Damian Conway
- Re: RFC 22 (v1) Builtin switch s... Jarkko Hietaniemi
- Re: RFC 22 (v1) Builtin swit... Chaim Frenkel
- Re: RFC 22 (v1) Builtin switch s... Chaim Frenkel
- Re: RFC 22 (v1) Builtin switch statement Damian Conway
- ConwayPerl (was Re: RFC 22 (v1) Builtin switc... Jeremy Howard
- Re: RFC 22 (v1) Builtin switch statement Bart Lateur