Le mardi 01 février 2005 à 18:57, Vladi Belperchinov-Shabanski écrivait:
> On Tue, 1 Feb 2005 15:57:33 +0100
> [EMAIL PROTECTED] (Philippe 'BooK' Bruhat) wrote:
> 
> > 
> > There's also @{[]} but I don't know f it has a name.
> > 
> > Usage: print "splatt @{[ ... ]} pow"
> > where ... is any valid expression, and the result list is join()ed with $"
> > (space).
> 
> [] construct reference to anonymous array, @{} dereferences the array ref. 
> finally the array is interpolated inside string.
> 
> it is equal to:
> 
>   @a = ( 1, 2, 3 );
>   print "splatt @a pow";
> 
> the only use is to force array context inside string:
> 
>   %a = ( 1, 2, 3 );
>   print "splatt @{[%a]} pow";
>   
> but don't think it is usefull (except obfuscation bonus:))

I won't defend its usefulness (we're here for fun), but sometimes you
don't want to type

    use Acme::MetaSyntactic 'batman';
    print "splatt " . join( " ", metaname(3) ) . " pow";

when

    use Acme::MetaSyntactic 'batman';
    print "splatt @{[metaname 3]} pow";

will do.

-- 
 Philippe "BooK" Bruhat

 A reputation is only as good as the truth beneath it, if any.
                                    (Moral from Groo The Wanderer #91 (Epic))

Reply via email to