Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

order matter

by oha (Friar)
on Sep 07, 2007 at 14:58 UTC ( #637674=obfuscated: print w/replies, xml ) Need Help??

that's a little tricky, i hope it's somewhat original
@d=split /\W/,"14-(5+(248<=>27)*0^b-7+(3.4.8))7b+1/27-1";$s=" r\n"; foreach $w (a..z){map{substr $s, hex, 0, $w;} split //,shift @d;} print $s;

Update: i'm not sure if i should put some "explanation" on what's above, and how "spoiler" works (which tag?)

Replies are listed 'Best First'.
Re: order matter
by jdalbec (Deacon) on Sep 07, 2007 at 22:53 UTC

      the idea was to start from an empty string, then add the chars to the string to a given position. I iterate from A to Z and use the strange string on top. this string is splitted using the \W. so looking at the start: "14-(5+(248" that will be splitted in ("14", ,"5", ,"248"). so the control data for the A is "14", nothing for B, then "5" for C and so on. the "14" is splitted again and i used the value in hex (this is important, for the "b" code later on), so i'll get 1 and 4, and then the string is updated inserting A in 1 and 4. the ending string is as expected JAPH. to keep the code small i was not able to use anything more then hex data, but a "r" was too far (more then 0xf) so i had to start with it in the string, as for the spaces.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: obfuscated [id://637674]
Front-paged by grinder
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2023-03-30 15:14 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (74 votes). Check out past polls.