Perlseeker_1 has asked for the wisdom of the Perl Monks concerning the following question:
i am trying to read a data from bunch of large files based on key element exist in another file
for example i have a file called file - 1 which has two fields name and number as below
file - 1
K 1 J 2 L 3 H 4
Bunch of large files contains data as below, i have mentioned only one file, we may have n number of files
file 01 K 01 JK 1234 J 02 HJ 5678 L 03 JH 6789 H 04 IH 5467
i am reading all the files and will store it in an array called @filelist
@filelist --------- file 01 file 02 file 03 file 04 file 05 file 06
i am reading each element from the file - 1 and will see if it exists in any of the files avialable in @filelist if exists i need to print the value of that element to text file
for example when i read a file - 1 , the first element is K, take the K and seacrh if it exists in any of the files available in @filelist, for example the value of K is available in file 01, print the K 01 JK 1234 to some text file called output.txt
My code
my @array; open F, "$input_file" or die "Couldn't Open File: $!"; while (<F>) { chomp; ( my ( $name, $num ) = split / /, $_ ) ; push (@array, $name); } foreach my $name (@array) { }
Can anybody please help me on syntac
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how to check if a particular value exist in list of files stored in an array
by baxy77bax (Deacon) on Oct 29, 2013 at 10:41 UTC | |
|
Re: how to check if a particular value exist in list of files stored in an array
by hdb (Monsignor) on Oct 29, 2013 at 11:36 UTC | |
by Limbic~Region (Chancellor) on Oct 29, 2013 at 11:57 UTC | |
by hdb (Monsignor) on Oct 29, 2013 at 12:12 UTC | |
by Perlseeker_1 (Acolyte) on Oct 30, 2013 at 05:10 UTC | |
by hdb (Monsignor) on Oct 30, 2013 at 07:12 UTC | |
|