Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

holy cow

by agoth (Chaplain)
on Oct 20, 2000 at 18:49 UTC ( [id://37682]=obfuscated: print w/replies, xml ) Need Help??

Just an indication of how bored I was this afternoon, I know its basic :P
$cow = ' x /\ x x x / \ x x / \ x x * x Y \ | (__) | x x x /| (oo) |\ * x / | /\/\ | \ x x x / |=|==|=| \ x * x / | | | | \ x x Y USA | ^||^ |NASA \ x x |______| ^^ |______| x x (__||__) x x x x /_\ /_\ x x x Y !!! !!! '; $cow =~ s/\s//g; $cells = ($cow =~ s/[^xY]//g); print map{chr($cells+$_)} map { $_ =~ tr/x//} split /Y/, $cow;

Replies are listed 'Best First'.
RE: holy cow
by princepawn (Parson) on Oct 20, 2000 at 19:49 UTC
    This is neat! Now, for a explanation of this code:

  • Remove all whitespace from the string $cow
    $cow =~ s/\s//g;
  • Remove all characters in $cow which are not x or Y. Bind $cells to the number of removals performed (which turns out to be 100)
    $cells = ($cow =~ s/[^xY]//g);
  • The next line has two maps.
    1. The first map operates on a list of 3 strings in which each string only contains a series of "x"s. Thus the tr command in the map is used to return the number of "x"s in each string it is fed. Ths resultant list is (9,11,11).
    2. The next map adds $cells (which is 100) to each of these numbers and prints the ascii value of these numbers, which prints out moo

      PRINCE "too bad user settings doesnt let me preview this" PAWN

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: obfuscated [id://37682]
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: (6)
As of 2024-03-29 09:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found