Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Array of arrays - redux

by space_monk (Chaplain)
on Jun 18, 2013 at 11:26 UTC ( #1039547=note: print w/ replies, xml ) Need Help??


in reply to Array of arrays - redux

# I assume this is already loaded up my @AoA; # lookback array my @lookback; my $lc = 0; while (my $el = shift $AoA) { my $search = $el->[3]; # see if search term in lookback if (grep("/$search/", map { $_->[3]}, @lookback)) { # found a match } if ($lc < 15) { $lc++; } else { # take 1 element off shift @lookback; } push @lookback, $el; }
If you spot any bugs in my solutions, it's because I've deliberately left them in as an exercise for the reader! :-)


Comment on Re: Array of arrays - redux
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1039547]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2015-07-05 18:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (67 votes), past polls