in reply to Re: finding the right corresponding element
in thread finding the right corresponding element


Dear toolic,

I have taken into account your remarks : thanks for your advice

the code I have updatd is exactely the same I just ran, so you can download it now safely, provided the name of the file that contains the data is "file"

Moreover, I have indicated in my updates the messages of error / warning
  • Comment on Re^2: finding the right corresponding element

Replies are listed 'Best First'.
Re^3: finding the right corresponding element
by toolic (Bishop) on Aug 13, 2007 at 15:18 UTC
    OK. That helps.

    I'm not sure why you are getting the warning on line 157. I suspect the problem may be somewhat related to your use of "tell" and "seek". I do not have much experience with these functions. It looks like you are reading the entire input file multiple times (once per time through your outer "while" loop).

    Is it really necessary to do this? Would it not be simpler and more efficient to slurp the contents of the input file into an array variable once, then use a "for" loop to process that array? Is input file size an issue?

      Thanks tooic for your quick reply

      No, the input file size is not an issue at all

      The idea was to look at each element of the first column, and for each of these elements, to browse through the whole elements of the second column

      Are you saying that @MY_ELEMNTS = <INFILE> could work ?

        I would probably create a different array variable, then do this:
        #!/usr/bin/env perl use warnings; use strict; my $file = "$ARGV[0]"; my @input_data; open INFILE_1, '<', $file or die "Can't open '$file' : $!\n"; @input_data = <INFILE_1>; close INFILE_1; # Just to show you that the @input_data array contains the same # content as the input $file, including all newlines (\n). print for (@input_data);