Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Delimitiations

by iamcal (Friar)
on Jun 12, 2001 at 19:01 UTC ( [id://87821]=obfuscated: print w/replies, xml ) Need Help??

Feel free to deconstruct...
my@a;my@x=(10,19,0,14,20,5,0,5,12,8,3,5);my@y=(21,20,1,15,8,18,16, 18,0,1,11,18);$_=q{map{s@a,g@y;s@a,g@x;}@y;};s;s;unshift;g;s;g;pop ;g;eval;$_=q sprint join'',(' ','a'..'z')[s.(join',',@a).q;]\;; ;eval;

Replies are listed 'Best First'.
Re: Delimitiations
by VSarkiss (Monsignor) on Jun 12, 2001 at 19:45 UTC
    # # Declare three arrays and populate two of them. # my @a; my(@x) = (10, 19, 0, 14, 20, 5, 0, 5, 12, 8, 3, 5); my(@y) = (21, 20, 1, 15, 8, 18, 16, 18, 0, 1, 11, 18); # # Set $_ to a string that looks suspiciously like code. # (Use ' instead of q{} to make the string stand out better.) # $_ = 'map{s@a,g@y;s@a,g@x;}@y;'; # # Change the letter s to 'unshift', and g to 'pop' + newline # (Use a more conventional / instead of ; to separate parts of s.) # s/s/unshift/g; s/g/pop\n/g; # $_ now looks like # map{unshift@a,pop # @y;unshift@a,pop # @x;}@y; # # or equivalently # # map { unshift(@a, pop @y); unshift(@a, pop @x) } @y; # # which if executed, would populate @a with alternating elements # of @x and @y (@x and @y would be empty, but that's immaterial). # # @a = qw(10 21 19 20 0 1 14 15 20 8 5 18 0 16 5 18 12 0 8 1 3 11 5 +18) # # Note that with a simple encoding of 1 = a, 2 = b, ..., # (with 0 = space) this is: # # @a = (qw(j u s t), ' ', qw(a n o t h e r) # , ' ' , qw(p e r l) , ' ' , qw(h a c k e r)) # # Execute the map, populating @a eval; # Now set $_ to this literal string # # print join'',(' ','a'..'z')[ # # followed by all the elements of @a, separated by commas, # and a closing square bracket. # The expression argument to join is now an array slice: # just those elements of (' ', 'a', ... 'z') # that are indexed by members of @a. # # (Using more conventional " instead of qs s and ' instead of q; ;.) # $_ = "print join'',(' ','a'..'z')[" . join(',', @a) . '];'; # Create the slice, join the elements and print it. eval;
    Better than caffeine! (Almost ;-) Thanks!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: obfuscated [id://87821]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2025-06-14 21:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.