Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Hash table checker doesnt work

by ferreira (Chaplain)
on Apr 10, 2007 at 10:03 UTC ( #609096=note: print w/replies, xml ) Need Help??


in reply to Hash table checker doesnt work

Update: That was a mistake. I didn't know what I looked at to see this error that isn't there.

The first thing I spotted in your code was:

next unless $token->[1]{href} =~ /\?page=/ || $token->[1]{class} =~ /t +op10_link/;
which has some precedence problems. You really meant:
next unless ($token->[1]{href} =~ /\?page=/) || ($token->[1]{class} =~ /top10_link/);
or
next unless ($token->[1]{href} =~ /\?page=/) or ($token->[1]{class} =~ /top10_link/);

Replies are listed 'Best First'.
Re^2: Hash table checker doesnt work
by hodashirzad (Novice) on Apr 10, 2007 at 10:30 UTC
    Thanks the code you said works but gives me errors (uninitialised) for the links that havent got class identified so I decided to use if statement instead of next unless :
    next unless defined($token->[1]{href}) || defined($token->[1]{class}) +; if (defined($token->[1]{class}) && $token->[1]{class} =~ /top10_link +/){ do some code } if($token->[1]{href} =~ /\?page=/){ do some code }
    Thanks again

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://609096]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2019-03-20 10:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How do you Carpe diem?





    Results (98 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!