in reply to Re^2: Memory issue with large array comparison
in thread Memory issue with large array comparison
You may be right. Certainly the regex you envision would be a tad clumsy. :)
At the moment, it's looking to me as though I should have written the code to support my claim re regex solutions, before posting, rather than simply doing a mental sketch (which proved to be wrong in at least that particular instance). Thank you for making me "think, again!"
However, on the theory that simple (or, in this case, 'concise') is desirable:
#!/usr/bin/perl use 5.014; # 972317 my @arr1 = ('C:\abc\def\zz456','C:\abc\xyz\ab123','C:\abb\bba\ac234',' +C:\abc\xyz\ab321'); my @arr2 = qw/ab123 ac234 ad456 ab321/; # no match for C: +\abc\def\zz456 my $dir_entry; my @arr3 = grep { $dir_entry = $_; not grep { $dir_entry =~ /\Q$_/i } +@arr2 } @arr1; say "Following is/are dir entry/entries (in \$arr1) without matching i +tems in \@arr2"; say each(@arr3);
Output ( index and array element; see each ):
0C:\abc\def\zz456
And can some knowledgeable Monk explain why the index of the zeroth element of the array is rendered as 0C?
Update: A knowledgeable Monk (++) has indeed explained... and the answer has little to do with the assumption immediately above. Meh! Blech on me.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Memory issue with large array comparison
by aaron_baugher (Curate) on May 25, 2012 at 03:56 UTC | |
by ww (Archbishop) on May 26, 2012 at 00:47 UTC | |
by aaron_baugher (Curate) on May 26, 2012 at 03:27 UTC | |
|
Re^4: Memory issue with large array comparison
by choroba (Cardinal) on May 25, 2012 at 12:07 UTC |