Re: Read a file as input
- --- In perl-beginner@y..., "Nguyen, David M" <david.m.nguyen@x>
> I have couple hundreds of host names saved into a file called"hostname".
> How do I tell my perl script to read that file as input?That all depends on how you want it to be read as input.
If you want to use STDIN (usually the easiest), just put "<
hostname" at the end of the command line when you run the script.
Then just read from the filehandle STDIN (no need to open or close
Otherwise, follow the directions to open/close/read (not in that
order) a file.