I Love being an intern... lets see if I have some mojo today....
first, break it apart on the semicolons and {}:
undef $/;
$\=$:;
$\=~s/-//;
$_ =<DATA>;
chomp;
s/\s+//gx;
map
{
$a=$2;
{
$a.=/^[<`~]/x?/\w/x &&($`eq'<'?'*':$`eq'~'?"\124": $`eq '`'?'I':0)
+x hex$&:/^[^TI*]/x?$"x hex $&:/./? substr ($_,0,1):0;$_=$';
$_ ne $,? redo:last ;
}
print $a;
}
(
split(/\|/))
__DATA__
B<C|B*A*B`3|B*A*AI2I|B*A*A`3|B*A<6T9T<7|B*FT2`5
2T7*|B*9~62I3I2~63*|B*8T7I3I7T4*|<C7~62
I3I2~66*|1*F6T2I3I2TD*|2*F4T2`5
2TE*|5<2 8**4T9TE*|8*4*4
*1~BD* |A<28*F5*|F7
*E*|F9*9*|FB
*6*|FC*4*|
FD*3*|
FE**
well, I guess that some interns are smarter than others, and I have no mojo today. :)
my apologies for filling up the replies with gibberish. The part that really hung me out was that bit after __DATA__, with the pipes. (to other monks:) what is that doing?
Update: WAIIIIT!!!! I just stepped back from it... pure genius... okay, so lemme get this straight... __DATA__ is being read in using the same syntax as <STDIN>??? OKay, that is cool... and then, the data is being shot through that loop?
++Interns!!!
Okay... so continuing then: first, you undefined the record separator ($/), then you redefined it to the line break character ($/ = $:;), then, redefined it again to a regexp matching the whole line(?) to replace all those dashes with nothing(?) (so, i'm assuming the first time you did it was for visual effect, aka space filling?),
Then, you read a line of data from __DATA__ <Still in awe that that works>
then, chomp the line, and use a regexp on it... lesse what that regexp does...
so, you treat the entire line as a record for the regexp, and match any number of whitespace characters, looping through the regexp and replacing said whitespace characters with nothing...
from there, call the map function, with the long regexp as the first argument, and the split as the list of characters to apply the map to.
from there, print it out to the screen.
I know i probably missed something, but this is my first ever shot at doing this..
Update again: Thanks jynx... dont know how I missed the difference between / and \. musta been goin too fast eh? thanks!
_________________________________________
E-Bitch
Tempora Mutantur Nos et Mutamur in Illis
"The Times are Changed Even as We are Changed in Them"
| [reply] [Watch: Dir/Any] [d/l] |
<QUASI-SPOILER>
Some minor corrections:
The first time he did
undef $/;
so that he could read in all of <DATA> at once, and then he set
$\=$:;
(note the different lean of the second character) which is the output record seperator so that his output is formatted properly. As a note, he sets it to " \n-" (the format line break variable) and then removes the hyphen, so his output record seperator is now a space followed by a "\n". Very convenient ;)
He formats $_ to have no line breaks or white space, then the map takes care of using the DATA as logic for how to visually represent the material. Since it's a map, when he prints $a it'll get treated as part of an array, which is useful for putting in the "\n" without being seen (from the output record seperator). Finding out the logic of the DATA section is left as an exercise for the reader.
Hope That Helps,
jynx
update: reworded a few lines...
| [reply] [Watch: Dir/Any] [d/l] [select] |
I was kind of hoping this would spit out a Texas flag captioned "Don't Mess With Texas", but the way it is makes a much nicer tribute to TI. :) | [reply] [Watch: Dir/Any] |