> -----Original Message----- > From: siren jones [mailto:[EMAIL PROTECTED]] > Subject: simple file reading question > > I have a file containing a list of names, for example: > > S2000123456.met > S2000123457.ozone > S2000123458.hdr > S2000234569.met > . > . etc. > > I'm looking for a short way to read these filenames onto an array. > > I tried: > > my @fils = <$indir/filename>; > > ..... but this just gives me the name of my input file > > I can do this, but it seems cumbersome. > > open LF or die "Can not find file: \n $infile $!\n"; > sysread LF, $filename, 50000; > @imgs = split(/\n/,$filename); > close (LF); > > Thank you in advance. > > -s
You're right, that does seem cumbersome. This solution isn't as nice and neat as what you'd like, but maybe it'll seem less cumbersome that what you mentioned: my ($file, @files); while (defined($file = <>)) { chomp ($file); push (@files, "$indir/$file"); } Hope this helps... Jason CONFIDENTIALITY NOTICE: ************************************************************************ The information contained in this ELECTRONIC MAIL transmission is confidential. It may also be privileged work product or proprietary information. This information is intended for the exclusive use of the addressee(s). If you are not the intended recipient, you are hereby notified that any use, disclosure, dissemination, distribution [other than to the addressee(s)], copying or taking of any action because of this information is strictly prohibited. ************************************************************************