in reply to •Re: Returning 1 entry from a conditional grep call to a hash value
in thread Returning 1 entry from a conditional grep call to a hash value

Just the pessimist in me thinking:

Will the WHILE see the additional keys that get added to %links within the IF processing block or will it only see the keys that were defined before entering WHILE?

TIA

======================
Sean Shrum
http://www.shrum.net

  • Comment on Re: •Re: Returning 1 entry from a conditional grep call to a hash value

Replies are listed 'Best First'.
•Re: Re: •Re: Returning 1 entry from a conditional grep call to a hash value
by merlyn (Sage) on Mar 29, 2002 at 01:46 UTC
    Oh! If you'll be adding to the keylist, you should use a different approach:
    while (1) { my @todo = grep ! defined $links{$_}{something}, keys %links or last +; while (@todo) { my $one = shift @todo; # process $links{$one} } }
    This presumes that something eventually defines all the "something" keys. If not, you need to use a sweeping strategy instead: I've done that for one of my link checker columns.

    -- Randal L. Schwartz, Perl hacker