in reply to Sub only grabbing first line from STDIN

"You're not incrementing $line" was my first impression, but in fact you have $line as the text you want, then you use it as an array index which probably evaluates to zero. To top it off, you assign to $line using that.

Also, it's a good idea to open an close handles at the same level, and to check for errors on system interfaces like open. Your &get_text sub takes no arguments, and really doesnt seem to add much to the organisation. Here is a decrufted version:

use Fcntl qw(LOCK_EX); open DOM_WORK, '> /usr/spool/lpd/dom/dom.work' or die $!; LOCK: { flock DOM_WORK, LOCK_EX or die $!; } for (<>) { tr/\x0c-\x0d//d; print DOM_WORK or die $!; } close DOM_WORK or die $!; &get_domkey; # whatever that is
I added locking in case of contention for the file. You may want to redo instead of dying, so I threw in the bareblock around that. If dom.work is some sort of queue, you probably want to open it to append ('>>')

After Compline,
Zaxo