in reply to URL-String-concatenation within Perl [applying to a loop]

WWW::Mechanize defines get() like this:

$mech->get($uri)

So you could simply do this:

my $mech = ....; for my $page_number (1 .. 1_000_000) { my $uri = "siteone_dot_com?show_subsite=$page_number"; my $response = $mech->get($uri); }

But it also appears you might be able to do something like this:

my $mech = ....; my $url = "siteone_dot_com"; my $param = 'show_subsite'; for my $value (1 .. 1_000_000) { my $response = $mech->get($url, $param => $value); }

Experiment and see if they both work.

Replies are listed 'Best First'.
Re^2: URL-String-concatenation within Perl [applying to a loop]
by Perlbeginner1 (Scribe) on Nov 27, 2010 at 20:09 UTC
    hello 7stud,

    many many thanks - i will experiment and have a closer look at both versions!

    i come back and report all my findings!

    greetings pb1