in reply to Selecting Random Sequence

Which part are you having problems with: the "random number" part, or the "fetch it from the web" part? With a little more guidance, we should be able to help you.

thor

Replies are listed 'Best First'.
Re: Re: Selecting Random Sequence
by Sameet (Beadle) on Apr 23, 2004 at 19:06 UTC
      Okay...that's a start. First, let's cover the "random sequence" part. I'll make some assumptions here, as I don't really have a lot to go on. I'll assume that you have your data in a single string (I'll call it $super). So, in order to get a "random sequence", there are two elements of randomness that we have the ability to introduce: length and starting position. I'll try to incorporate both.
      my $start = int(rand(length($super))); my $length = int(rand(length($super) - $start)) + 1; my $substring = substr($super, $start, $length);
      Of course, you could make either $start or $length static by just assigning a value to them.
      Now, on the the fetching part. Once you have all of the appropriate values for the variable in your URL, fetching it is not so bad:
      use LWP::Simple; getstore($url, $localfile);
      If I can elaborate any further, let me know how and I'll do my best.

      thor