in reply to printing a string

Grandfather's suggestions seem reasonable, but maybe you want to do it yourself.
The reason that your system command did not work is that nothing is actually writing to the pipe. You maybe meant:
system "echo $$string | lp -"
Did you mean $$string? That makes $string a reference; just thought I'd ask.
Since the string could be large it might be better opening a pipe using
open(my $handle,'|-', 'lp -') or die "Oops: $!";
Then use print to write to the pipe (don't forget to close the handle).

Replies are listed 'Best First'.
Re^2: printing a string
by diamantis (Beadle) on Apr 13, 2007 at 15:41 UTC
    Thanx for all suggestions! I used used open to open a pipe and it is working! Because I am writing a gui program I would not like to have them installing modules etc.