Front page | perl.fwp |
Postings from January 2002
Re: even.pl solutions
Thread Previous
|
Thread Next
From:
Jeff 'japhy' Pinyan
Date:
January 29, 2002 08:24
Subject:
Re: even.pl solutions
Message ID:
Pine.GSO.4.21.0201291123370.27903-100000@crusoe.crusoe.net
On Jan 29, Eugene van der Pijll said:
>Stephen Turner schreef op 29 januari 2002:
>> Five programs didn't use $. , of which the shortest is this one from Ton
>> Hospel in equal third place:
>>
>> -ln ($a=aeiouy)=~s!!--&~y-!g;eval"\$|$a--c&&print" 50 ton
>>
>> It's another meta-program. The line counting is done by $|-- , although even
>> that isn't obvious until you've worked out what $a is above.
>
>There is more going on than that. Why does Ton use the variable $| ? Any
>other variable doesn't work...
Well, because $| is the magical flip-flop variable, so long as you -- it
and not ++ it.
for (1 .. 6) {
print --$|, "\n";
}
--
Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
Thread Previous
|
Thread Next