Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

WWW::Mechanize::Firefox Navigate Issue !

by Matt™ (Acolyte)
on Nov 03, 2012 at 12:52 UTC ( #1002101=perlquestion: print w/replies, xml ) Need Help??
Matt™ has asked for the wisdom of the Perl Monks concerning the following question:

Dear Mons, I have a doubt regarding the below codes. Can you pls suggest a way?

Is there a provision to pass a string to it like below,

my $Pager = "submit"; my $find_button = $mech->xpath('//*[@id="$Pager"]', single => 1 ); $mech->click( $find_button );

Its not getting me through! Giving an error like 'NO elements found'

Thanks in advance.

Replies are listed 'Best First'.
Re: WWW::Mechanize::Firefox Navigate Issue !
by aitap (Curate) on Nov 04, 2012 at 08:10 UTC
      *cough*  Possible unintended interpolation of @id in string at - line 1.
Re: WWW::Mechanize::Firefox Navigate Issue !
by hippo (Canon) on Nov 03, 2012 at 14:45 UTC

    Using single quotes like you have in your example supresses variable substitution in Perl just like it does in bash. See what happens here:

    my $bcount = 5; print "I ate $bcount biscuits "; print 'I ate $bcount biscuits ';

    Use single quotes for literal strings, use double quotes for interpolation (including variable substitution.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1002101]
Approved by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2018-06-19 08:01 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (111 votes). Check out past polls.