Path: utzoo!attcan!uunet!deimos!ux1.cso.uiuc.edu!brutus.cs.uiuc.edu!psuvax1!news From: ehrlich@cs.psu.edu (Daniel Ehrlich) Newsgroups: comp.lang.perl Subject: Re: Randal's one-liners Message-ID: Date: 5 Mar 90 18:18:27 GMT References: <15214@bfmny0.UU.NET> <15216@bfmny0.UU.NET> <7250@jpl-devvax.JPL.NASA.GOV> Sender: news@cs.psu.edu (Usenet) Organization: Computer Science Department, Penn State University Lines: 30 In-Reply-To: lwall@jpl-devvax.JPL.NASA.GOV's message of 2 Mar 90 20:12:50 GMT In article <7250@jpl-devvax.JPL.NASA.GOV> lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) writes: Larry> In article <15216@bfmny0.UU.NET> tneff@bfmny0.UU.NET (Tom Neff) writes: Larry> :This is three lines out of courtesy to newsreading software -- it Larry> :runs fine as one long line.. :-) Larry> : Larry> :@a=split(//,'1111211111131223311361214223121412311341121111222123616111111122'. Larry> :'21233212615112114212321211121111222123321120');for$r(@a){for(1..$r){vec($s,$i, Larry> :1)=$v;$i++;}$v^=1;}print"$s\n"; Larry> Or, more concisely, Larry> for(split(//,'))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)"')) Larry> {for(ord){$i+=$_&7;grep(vec($s,$i++,1)=1,1..($_>>3)-4);}}print"$s\n"; Larry> And a special version just for Randal: Larry> grep(do{for(ord){$i+=$_%8;grep(vec($s,$i++,1)=1,5..($_>>3||print"$s\n"));}}, Larry> (@x=split(//,"))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)\7"))); Larry> Larry Could one of the perl gurus take a moment to enlighten a novitiate perl hacker as to how or why any or all of these examples do what they do? Other than that they all print out 'Just another Perl hacker,'. Thanks. -- Dan Ehrlich Voice: +1 814 863 1142 FAX: +1 814 865 3176