Re: Creating an array from file input



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 =---
.



Relevant Pages

  • Re: Logon script - function array and select case not working
    ... this all works well, except, the function i am using for the rules in the control script causes alot of querrys to AD. as there are alot of groups. ... objTSout.writeline retrv ... So if you think that this will assign an array value to the variable, how do you think the case select statement is going go compare this array value with the literal string values such as "group name here"? ... However, by not assigning ANY value to checkgrp in the function, you are guaranteeing that, should the function ever exit, it will return no information. ...
    (microsoft.public.scripting.vbscript)
  • Re: string retrieval issue
    ... Chicago Bears|NFC North ... not writing the third element back to the array). ... You didn't include it in your script. ... Fear is the mind-killer. ...
    (comp.lang.perl.misc)
  • Re: even rows for checkbox forms with no splitting of boxes from values
    ... 'mod' on the array length with a denominator equal to the width of the row, ... State saving really depends on what the script is already doing. ... So I usually roll my own checkboxes. ... #this is to create an array with 25-50 strings 2-10 in length ...
    (comp.infosystems.www.authoring.cgi)
  • Re: settimeout needs alert() ???
    ... function slider { ... and use script to replace the src and title attributes. ... are downloaded completely. ... The usual strategy is to load all of the images in to an array of image ...
    (comp.lang.javascript)
  • Re: BinaryStream.Write ByteArray erroring with Code 800A0BB9, Source ADODB.Stream
    ... script is reaching out to a SQLServer database and grabbing some data ... BinaryStream.Write method expects a byte array, ...     Else ... I made the changes to the script using your code, ...
    (microsoft.public.scripting.vbscript)