|
Prev: FAQ 4.73 How do I print out or copy a recursive data structure?
Next: FAQ 5.16 Is there a leak/bug in glob()?
From: Doug Laidlaw on 22 Feb 2007 22:00 I have a Perl script (pcal) which prints to standard output. I didn't write it. The relevant line is $THECAL=`....'; print $THECAL; I want to modify this line to print to the default (local) printer on lpr. How do I go about this? TIA, Doug. -- Books are good enough in their own way; but they are a mighty bloodless substitute for life. -R.L. Stevenson.
From: Sherm Pendley on 23 Feb 2007 00:36
Doug Laidlaw <laidlaws(a)dougshost.invalid> writes: > I have a Perl script (pcal) which prints to standard output. I didn't write > it. > > The relevant line is $THECAL=`....'; print $THECAL; > > I want to modify this line to print to the default (local) printer on lpr. > How do I go about this? Open a pipe to lpr and select it: my $THECAL = '....'; open my $lpr, '|-', '/usr/bin/lpr' or die "Could not open lpr pipe: $!"; select $lpr; print $THECAL; For details: perldoc -f select perldoc -f open If you want to make only one or two prints go to lpr, instead of all of them, you can specify the filehandle in the print: print $lpr $THECAL; sherm-- -- Web Hosting by West Virginians, for West Virginians: http://wv-www.net Cocoa programming in Perl: http://camelbones.sourceforge.net |