develooper Front page | perl.fwp | Postings from February 2005

Re: "Secret" operators

Thread Previous | Thread Next
From:
Vladi Belperchinov-Shabanski
Date:
February 1, 2005 08:57
Subject:
Re: "Secret" operators
Message ID:
20050201185747.5de61f73.cade@biscom.net
On Tue, 1 Feb 2005 15:57:33 +0100
philippe.bruhat@free.fr (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:))

--
Vladi Belperchinov-Shabanski <cade@biscom.net> <cade@datamax.bg>
Personal home page at http://cade.datamax.bg/
DataMax SA   http://www.datamax.bg
there is still one truth on which we can depend
we've started something we can never end

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About