Front page | perl.fwp |
Postings from February 2005
Re: "Secret" operators
Thread Previous
|
Thread Next
From:
Vladi Belperchinov-Shabanski
Date:
February 1, 2005 09:11
Subject:
Re: "Secret" operators
Message ID:
20050201191105.332c26e9.cade@biscom.net
On Tue, 1 Feb 2005 11:49:57 +0000
Jos_ Castro <jac@natura.di.uminho.pt> 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 <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