Re: "Secret" operators

Vladi Belperchinov-Shabanski <[email protected]>
Newsgroups gmane.comp.lang.perl.fun
Organization CSA
Message-ID <[email protected]>
On Tue, 1 Feb 2005 11:49:57 +0000
Jos_ Castro <[email protected]> wrote:

> Hi, guys.
> 
> Apart from the "secret eskimo greeting" and the "goatse operator", can
> anyone tell me about other "secret" operators?
> 
> Examples:
> 
> eskimo:   }{
> goatse:   =()=
> 
> eskimo usage:   perl -ne '}{print $.'

   perl -MO=Deparse -ne 'print $.'

has this actual code:

   LINE: while (defined($_ = <ARGV>)) {
       print $.;
   }

on the other hand your example:


   perl -MO=Deparse -ne '}{print $.' 

actually is:


   LINE: while (defined($_ = <ARGV>)) {
       ();
   }
   {
       print $.;
   }

the trick is that you can have loop and finish code:

   perl ' loop-code-here }{ finish-code-here'

> goatse usage:   perl -e '$_="zbrughau";$b=()=/u/g;print $b'

   $b = () = /u/g;

is the same as:

   @a = /u/g;
   $b = @a;

i.e. () forces array context (actually it is array), then returns element count in $b

no big secrets here, though I never thought of such () use. thanks for the hint :))

-- 
Vladi Belperchinov-Shabanski <[email protected]> <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.