Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: How can I retrieve the link with the highest number in it using Perl?

by toolic (Bishop)
on Jul 10, 2013 at 01:31 UTC ( #1043404=note: print w/ replies, xml ) Need Help??


in reply to How can I retrieve the link with the highest number in it using Perl?

Maybe use anchors?

my @links = map {$_->text} grep {$_->text =~ m/^\d+$/} $mech->find_all_links();


Comment on Re: How can I retrieve the link with the highest number in it using Perl?
Download Code
Replies are listed 'Best First'.
Re^2: How can I retrieve the link with the highest number in it using Perl?
by virtus (Initiate) on Jul 10, 2013 at 01:49 UTC

    Hi, tnx for your fast reply, now its working. But please, explain me something... why do I have to call the find_all_links function with no arguments to it so my @links array gets filled?

    That was not much clear to me... one friend of mine was helping me with this script

    tnx for your time.

      Why do I have to call the find_all_links function with no arguments to it so my @links array gets filled?
      Perhaps you were distracted by the multi-line statement?

      This:

      my @links = map {$_->text} grep {$_->text =~ m/^\d+$/} $mech->find_all_links();

      is equivalent to this:

      my @links = map {$_->text} grep {$_->text =~ m/^\d+$/} $mech->find_all +_links();

      (When I first read the original, I didn't see the lack of semicolon on line 1, which made me think it was an example from Damian's time reversed variables.)

      Then read right to left.

      -QM
      --
      Quantum Mechanics: The dreams stuff is made of

        Oh, now I see... tnx man!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2015-07-28 10:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (254 votes), past polls