PerlDiscuss - Perl Newsgroups and mailing lists wrote:
I'm just a beginner to perl and am having some beginner type problems.
I need to import a external file containing 15 character ID numbers (one
per record) into an single dimensional array within perl. Later this array
will be used to interrogate other data within the program.
Can someone out there give me a example of how they have done something
similar to this?
Thanks,
Dave Crum
I suppose your file has one ID number per line, like this:
id.txt:
123456789012345
383292392393229
249429294292492
429494943239849
#!/usr/bin/perl
use strict;
open(ID,"id.txt") or die "Cannot read id.txt: $!\n"; # open file for reading
my @array = <ID>; # read whole file in array
chomp for @array; # trim "\n" at the end
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>