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

Reply via email to