Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Creating an array from file input
July 18, 2005, 7:58 pm
rate this thread
I need to create an array of file names from an existing text file. I
need to find out how to read a text file that contains the file names
on a multiple line text file. Each individual file name is on a single
line by itself.
I want to create an array of the file names to use as input to a
system command that will loop through the file names.
Re: Creating an array from file input
Enter the name of the file containing the file names as a command-line
argument to your script. Then put the following in the script:
my @files = <>;
You now have an array of file names.
For more information see
perldoc perlop (and search for 'I/O Operators' and 'null filehandle')
Also look at
perldoc -f open
for alternate methods of reading a file.
If you have any more problems, please post a program. Thanks.
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000
---= East/West-Coast Server Farms - Total Privacy via Encryption =---