Re: Creating an array from file input
- From: Jim Gibson <jgibson@xxxxxxxxxxxxxxxxx>
- Date: Mon, 18 Jul 2005 15:01:53 -0700
In article <1121716712.115126.33330@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
johnd <jdawson43@xxxxxxxxxxx> wrote:
> Hello,
>
> 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.
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 = <>;
chomp(@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 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
.
- References:
- Creating an array from file input
- From: johnd
- Creating an array from file input
- Prev by Date: length limitation with split() ?
- Next by Date: FAQ 4.72 How do I keep persistent data across program calls?
- Previous by thread: Re: Creating an array from file input
- Next by thread: Re: Creating an array from file input
- Index(es):
Relevant Pages
|