Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
line 1 line 2 line 3 .. line 12I need to read them into an array, which should look like this:
line1 line2 line3 .. line 12 # content of file 1 line1 line2 line3 .. line 12 # content of file 2 .. line1 line2 line3 .. line 12 # content of file xI've started with the following code:
But this of course prints only all lines under each other. Can anybody tell me how to go on?foreach $member (@memberlist) { open(FILE, "$member.dat"); lock(FILE); @members = <FILE>; unlock(FILE); close(FILE); foreach $line (@members) { push(@allmembers, $line); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re (tilly) 1: Reading content of many files in an array
by tilly (Archbishop) on Sep 25, 2001 at 04:14 UTC | |
|
Re: Reading content of many files in an array (join)
by mandog (Curate) on Sep 25, 2001 at 02:31 UTC | |
|
Re: Reading content of many files in an array
by jlongino (Parson) on Sep 25, 2001 at 02:38 UTC | |
|
Re: Reading content of many files in an array
by Zaxo (Archbishop) on Sep 25, 2001 at 02:39 UTC | |
|
Re: Reading content of many files in an array
by blakem (Monsignor) on Sep 25, 2001 at 02:39 UTC | |
|
Re: Reading content of many files in an array
by ducky (Scribe) on Sep 25, 2001 at 02:53 UTC |