Hi Experts,

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


In reply to how to check if a particular value exist in list of files stored in an array by Perlseeker_1

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.