Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re^3: printing source code green bar style

by Aristotle (Chancellor)
on Sep 17, 2004 at 19:20 UTC ( #391878=note: print w/replies, xml ) Need Help??

in reply to Re^2: printing source code green bar style
in thread printing source code green bar style

I don't think it's particularly strange given how trivial it is. Use CSS instead of a table and stick the lines in some block-level element. A stylesheet like this should be all you need:

p.even, p.odd { margin: 0; padding: 0.2em; } p.odd { background-color: #ccc; }

And then you stick the lines in

<p class="even">#!/usr/bin/perl</p> <p class="odd">use&#160;strict;</p> <p class="even">use&#160;warnings;</p> <p class="odd"></p> <p class="even">BEGIN&#160;{</p> <p class="odd">&#160;&#160;&#160;&#160;$|&#160;=&#160;1;</p> <p class="even">}</p> ...

Makeshifts last the longest.

Replies are listed 'Best First'.
Re^4: printing source code green bar style
by Your Mother (Bishop) on Sep 18, 2004 at 05:35 UTC

    I think Aristotle's solution is the best (there's no way you'll get a laser printer to line up correctly on pre-lined paper without wasting lots o'paper). Here's a one liner to do what he suggests.

    perl -MCGI -lp -e '$_ = CGI::p({-class=> $c++ % 2 ? 'even':'odd'}, $_ )' [file list]

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://391878]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2020-05-29 00:26 GMT
Find Nodes?
    Voting Booth?
    If programming languages were movie genres, Perl would be:

    Results (166 votes). Check out past polls.