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

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?

  • Comment on Re^3: finding the right corresponding element

Replies are listed 'Best First'.
Re^4: finding the right corresponding element
by steph_bow (Pilgrim) on Aug 13, 2007 at 15:38 UTC

    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);