CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [dilbert] Global symbol errors - all along the way... need help with a little script: Edit Log



Chris Charley
User

Nov 10, 2017, 8:29 AM


Views: 9974
Re: [dilbert] Global symbol errors - all along the way... need help with a little script

Hello,

Just one problem I see in your fixed script.

the line: next if $visited{$url};

really should be: next if $visited{$url}++;

The first time you see a particular url, it will be undefined (false) so the next won't apply. But the next time you find the same url, it will be defined (value == 1 == true) so the next will execute.

The '++' is a post increment so if the first time a url is found it will test then increment - that's how this works.


(This post was edited by Chris Charley on Nov 10, 2017, 8:31 AM)


Edit Log:
Post edited by Chris Charley (User) on Nov 10, 2017, 8:31 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives