in reply to Threading two text files

If you're going to use seek, read the documentation, the first graf of which explains how to increment the position:
 seek FILEHANDLE,POSITION,WHENCE
        Sets FILEHANDLE's position, just like the "fseek" call of
        "stdio". FILEHANDLE may be an expression whose value gives the
        name of the filehandle. The values for WHENCE are 0 to set the
        new position *in bytes* to POSITION; 1 to set it to the current
        position plus POSITION; and 2 to set it to EOF plus POSITION,
        typically negative. For WHENCE you may use the constants
        "SEEK_SET", "SEEK_CUR", and "SEEK_END" (start of the file,
        current position, end of the file) from the Fcntl module.
        Returns 1 on success, false otherwise.

Assuming your really intend to do something like this:

#!/usr/bin/perl use 5.016; use Data::Dumper; #1033562 (and id num_qqq.txt, idnum_exp.txt) =head file 1033562_exp.txt exp.txt 0 foo 3 bar 1 table 3 quux 3 fail 2 file 1033562_qqq.txt qqq.txt 0 fail 2 nope 1 foo 3 insert 1 bar 1 quux 3 table 3 tambourine 2 fred 14 =cut open(INDB, "1033562_exp.txt") or die "Can't open exp file, $!"; open(QQQ, "1033562_qqq.txt") or die "Can't open data file, $!"; my (@search, @therecs); while(<INDB>) { my $search = $_; chomp($search); say "\$search at Ln28: $search"; push @search, $search; seek(INDB, 0, 0); } print "\n\n"; while(<QQQ>) { my ($ma,$id); my $therec = $_; say "Both elements of \$therec at Ln36: $therec"; chomp($therec); ($ma,$id ) = split(/\t/, $therec); push @therecs, (" $ma " . "| $id |"); my $Qpos=tell QQQ; say "\n\t POS in QQQ: $Qpos \n"; } say "\n \t array search next:"; say Dumper @search; say "\n \t Array @therecs next:"; say Dumper @therecs;
</c>

Identifying the matches is left as an exercise to the SOPW. %hash might be an approach; so too might what you originally suggest but didn't implement-- walking the arrays in parallel. Both are well documented in threads here in the Monastery.


If you didn't program your executable by toggling in binary, it wasn't really programming!