Thank you for the prompt and informative replies! I knew that there way a way to do it. Perl rocks!

I have posted the updated code snippit which is now working, below.

Thanks again!

#!/usr/bin/perl -t use strict; use warnings; use Net::CUPS::Destination; use File::Temp qw/tempfile/; my ($filehandle,$filename) = tempfile(UNLINK=>1); # Define Printer my $cups = Net::CUPS->new() or die $!; my $printer = $cups->getDestination("CITIZEN-CT-S801") or die $!; open($filehandle, '>', $filename) or die "Cannot open file for writing +: $!\n"; print $filehandle "Some data 1\n"; print $filehandle "Some data 2\n"; print $filehandle "Some data 3\n"; close($filehandle); # Print Data open($filehandle, '<', $filename) or die "Cannot open file for reading +: $!\n"; if ($printer->printFile($filename, 'jobx')) { print 'Success';} else { my $error = $printer->getError(); if ($error) { print "Printer Error: " . $error . "\n"; } } close($filehandle); exit;

In reply to Re: CUPS Printing - Using a Variable as a Filename by Wayne
in thread CUPS Printing - Using a Variable as a Filename by Wayne

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.