I have a loop which takes an array that already contains some url's. The array starts processing the url's and after some work for filtering which links i need it adds the links to the array which i use for the loop. And that seems to confuse the program. For and foreach loops don't work for sure, and while loops don't seem to work either.
If i put a number for example x < 900 then the script is executed perfectly but if i leave something like x < links then it doesn't. Is there a solution for a problem like this? (I presume there is!). Thanks for the help in advance.
for(my $x = 0; $x < @links; $x++) { $webcrawler->get($links[$x]); my @more_links = map { $_->[0] } $webcrawler->links; # get Links @more_links = map { URI->new_abs( $_, $base_url ) } @more_links; @more_links = map { /^$base_url/ ? $_ : () } @more_links; # Add the filtered links from the more_links array to the links a +rray push(@links,@more_links); #Finally, recursively go through the array and remove URL's that a +ppear twice or more @links = do { my %z; grep { !$z{$_}++ } @links }; }
In reply to Processing a dynamic array by lampros21_7
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |