open DOM_WORK, '>/usr/spool/lpd/dom/dom.work';
&get_text;
sub get_text{
my @text=(<>);
my $line =0;
foreach $line (@text) {
my $text =$text[$line];
$text =~tr/\x0c-\x0d//d;
select DOM_WORK;
print "$text[$line]";
close DOM_WORK;
}
&get_domkey;
}
####
open DOM_WORK, '>/usr/spool/lpd/dom/dom.work';
&get_text;
####
open my $DOM_WORK_FH, '>/usr/spool/lpd/dom/dom.work' or die "Open dom.work failed $!";
get_text($DOM_WORK_FH); # you could also pass in the filename and open the file in the sub...
####
sub get_text{
my @text=(<>);
my $line =0;
foreach $line (@text) {
####
sub get_text {
my $out_fh=shift #what filehandle to write to
while (<>) { # read a line at a time into $_
####
my $text =$text[$line];
$text =~tr/\x0c-\x0d//d;
####
tr/\x0c-\x0d//d; # strip unwanted chars from $_
####
select DOM_WORK;
print "$text[$line]";
close DOM_WORK;
####
print $out_fh $_;
####
use strict;
use warnings;
sub get_text{
my $output_file=shift;
open my $out_fh,">".$output_file or die "Failed to open $output_file because $!";
while (<>) {
tr/\x0c-\x0d//d;
print $out_fh $_;
}
}
get_text('/usr/spool/lpd/dom/dom.work');
get_domkey();