Welcome back, ppt! I figure why not go for the low-hanging fruit, so here's file2c. Let me know about desired changes & stuff. The 'shift||""' is ugly, but I wanted to run under -w.
Without a UNIX box handy, I don't know if it's supposed to print a \n
at the end or not. I also have no idea if it's doing the right thing
for the wide hex char in there: I just stole it from the perlop man
page.
It would probably be generous to call this a test suite, but:
>perl -e "print qq{\t\n\0\cx\x{263a}x~}" | perl file2c.pl
9,10,0,24,226,152,186,120,126
>perl -e "print qq{ab}" | perl file2c.pl a b
a97,98b
>perl -e "print qq{ab}" | perl file2c.pl a
a97,98
>perl -e "print qq{ab}" | perl file2c.pl "" b
97,98b
>perl -e "print qq{}" | perl file2c.pl a b
ab
-Amir Karger
ps I'm soon going to post to CPAN an alpha Z-machine translator, which
could get 'advent' done, too - although it depends on which port of
Advent you want.
file2c
Description: Binary data
