in reply to emulate "fgrep -f file" with results ordered by "file"

but this does not work...
That is not descriptive enough, and you haven't shown enough of your code, but here are a couple suggestions:

Replies are listed 'Best First'.
Re^2: emulate "fgrep -f file" with results ordered by "file"
by coldy (Scribe) on Mar 15, 2011 at 02:32 UTC
    thanks for the suggestion - chmop worked. There is one other problem - it is fairly slow. There are about 1M itmes to grep from @list and @large has a few more lines than that (about 1.2M )..any ideas on how to do this more efficiently?

      You could create an index (=hash lookup table) by the first field of 'large'.  Then loop over @list and check if the key exists in the lookup table.

      Something like

      my %index; while (<DATA>) { # your $large my ($f1) = split; $index{$f1} .= $_; } my @list = qw(foo r2c1 bar r3c1); for (@list) { print $index{$_} if exists $index{$_}; } __DATA__ r1c1 r1c2 r1c3 r2c1 r2c2 r2c3 r3c1 r3c2 r3c3
        thankyou very fast indeed!