[ic] Stoopid question and offer

John Young john_young at sonic.net
Tue Nov 28 03:24:02 EST 2006


Tom Tucker wrote:
> Can anybody tell me why:
> 
>     [calc]($Scratch->{first},$Scratch->{last}) = split(/:\s/, "Tom:
> Tucker");[/calc]
> 
> should output "2" on a page?

Because you have no explicit return, it's returning the last thing it
did -- and it's doing so in a scalar context.  A two element array (in
this case an anonymous one) referred to in a scalar context yields "2".

If you just want to hide it, I suppose you could add "return;" after
your final semicolon.


-John Young


More information about the interchange-users mailing list