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

Reply via email to