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