Lorne Easton wrote:
> 
> The following code:
> 
> ---- SNIP ----
> 
> sub return_internal_links
> {
> 
>  foreach my $element (@links) {
> 
> my $all_internal = join("\n",@internal),"\n";
> 
> if (($element =~ m/$startingurl/i) && ($all_internal !~ m/$element/gi)) {
> 
>       print $element,"\n";
>       push (@internal, $element);
>   }
>      }
> 
> }
> 
> ---- SNIP ----
> 
> Still adds the value to the array whether the value is in
> internal or not. I am missing something stupid here I know. Could someone
> please enlighten me..
> 
> I want the value matched if not in @internal and if
> it contains $startingurl..


Here is one way to do it:

sub return_internal_links {
    my %temp;
    $temp{ lc $_ } = $_ for @internal;
    /\Q$startingurl/i and $temp{ lc $_ } = $_ for @links;
    @internal = values %temp;
    }



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to