[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Obfuscated Perl AI



On Sat, Jul 03, 1999 at 12:51:19AM -0400, Brian Keefer wrote:
> So, can you see the simple, elegant change here? 
>  
> for(<>){split;$n='>';$w{$n}.=" $_[0]";while(@_){$w{$_[0]}.=$".($#_?$_[1]:0);
> shift@_}while($n){print"$n ";split' ',$w{$n};$n=$_[rand@_]}print$/}

[the change was swapping "while" at the start for "for"]

Grrr, that's annoying. Again, you can tell I'm really a C
programmer---for(x;y;z) is too deeply ingrained into my cortex to allow me
to do for(x).

Plus perlvar(1) says:

     $_ [...]     The default place to put an input record when a
                  <FH> operation's result is tested by itself as
                  the sole criterion of a while test.  Note that
                  outside of a while test, this will not happen.
                                           ^^^^^^^^^^^^^^^^^^^^

So I'd kind of assumed that a "for" test rather than a "while" test would
mean it wouldn't work. :)

-- 

Adam Sampson
azz@gnu.org

==== Want to unsubscribe from Fun With Perl?
==== Well, if you insist... Send mail with body "unsubscribe" to
==== fwp-request@technofile.org