For loop help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jenny04
    New Member
    • Mar 2007
    • 4

    For loop help

    Hey i have wrote a perl program and it works when i run it, but i want to add a for loop to run it a load of times. Ive tried putting the for loop in a few different places but keep getting errors.

    Here is the code:
    --------------------------------------------------------------

    #!c:/perl/bin/perl
    #
    use strict;
    use WWW::Mechanize;

    my $url = "http://www.google.com" ;

    my $mech = WWW::Mechanize->new();
    $mech->get( $url );

    print $mech->content;

    ---------------------------------------------------------------

    Does any1 know were i would add the for loop to.

    Thanx
  • miller
    Recognized Expert Top Contributor
    • Oct 2006
    • 1086

    #2
    Umm Jenny?

    Why are you wanting to spam google? It feels both odd that you would want to do this. And secondly, that you would bother asking the question, as a for loop is not exactly a complicated programming construct.

    - Miller

    Comment

    • KevinADC
      Recognized Expert Specialist
      • Jan 2007
      • 4092

      #3
      Code:
      #!c:/perl/bin/perl
      #
      use strict;
      use WWW::Mechanize;
      
      my $url = "http://www.google.com";
      
      my $mech = WWW::Mechanize->new();
      $mech->get( $url );
      
      print $mech->content;
      
      for (1..1000000000000) {
         sleep 1;
      }
      the devil made me do it ;)

      Comment

      • jenny04
        New Member
        • Mar 2007
        • 4

        #4
        Originally posted by miller
        Umm Jenny?

        Why are you wanting to spam google? It feels both odd that you would want to do this. And secondly, that you would bother asking the question, as a for loop is not exactly a complicated programming construct.

        - Miller
        No not wanting to spam google, just using google as an example, rather than put the actual website up.

        Comment

        • miller
          Recognized Expert Top Contributor
          • Oct 2006
          • 1086

          #5
          Originally posted by jenny04
          No not wanting to spam google, just using google as an example, rather than put the actual website up.
          Well, what have you tried so far?

          - Miller

          Comment

          Working...