Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Certainly learning

by Adam (Vicar)
on Oct 11, 2000 at 04:00 UTC ( [id://36164]=note: print w/replies, xml ) Need Help??


in reply to Certainly learning

I think you already understand the tools, so I will just point you in the right direction. You want to open the file and read each line from it. Do this thusly:
use strict; # ALWAYS! my $filename = 'devices.txt'; # Hardcode the filename. # you could get the filename off the # command line using shift, but be # aware of the consequences of your # actions. open FILEHANDLE, $filename or die "Failed to open '$filename', $!"; while( <FILEHANDLE> ) # Read the file one line at a time. { chomp; m/\d{10}/ or warn "Unknown arg '$_', skipping\n" and next; # Process the device numbered $_ } close FILEHANDLE;
Code is untested, but that is okay. It is meant to point you in the right direction, not solve everything... thats what they pay you to do.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://36164]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-26 00:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found