my @visited_urls = ($url_name); ... while (@website_links) { if ((grep {$_ eq $website_links[0] } @visited_urls) > 0)