a2ps (the swiss knife of pretty-printing) actually already has support for doing this. a2ps uses different styles for its printouts and one of those is named 'matrix'.
so, by running:
a2ps --prologue=matrix -o test.ps test.pl
it will generate a suitable matrix style printout. The default is to alternate the background each 6. line, but this can be adjusted.
(I tested with a2ps 4.13b. I had a postscript-problem with an earlier version before I asked apt to kindly update it.)
I actually didn't find out how to adjust that value now, so I ended up patching matrix.pro (the prologue file). I changed the expand-line to:
%Expand: nline #{pro.matrix.cycle:-2} mod #{pro.matrix.gray:-1} ge {
-Thorkild
PS: Yes, a2ps knows perl already |