I appreciate everyone willing to help! I have tried many different methods and I'm still having issues dealing with Perl reading the file and dealing with addqueue properly. The reason why I had $file mentioned so much probably is silly to you guys but I'm using Getopt::Long, I setup an option called -f which stores as \$file, if $file is called then I'll execute my code, unfortunatly I couldn't see another way to open the file handle other than $file since of course the string rely's on <STDIN>.
The purpose of this program is to make the process of adding print queues standard and seemless, (we have various flavors of *nix), if I can make it intuitive enough; I can pass the workload to the applications teams :).
I wanted to have the functionality of a user throwing a text file in wherever they want and then call the option. Such as mkpq -f /tmp/printers.txt, of course the /tmp/printers.txt will be stored as $file and that's why it was mentioned so much.
I am a new Perl programmer I'm trying to read as much as possible but with no programming background it makes it tough to do things correct. Albeit I do appreciate constructive criticism, I'll keep poking around with this chunk of code, as the rest of my program works great!
Thanks again Monks.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.