PureBytes Links
Trading Reference Links
|
On Fri, 8 Jan 1999, Alton Stephens wrote:
> what is PERL?
Perl is a programming language. It's strong point is the productivity it
gives you in terms of results per line of code. Here is an example from
yesterday. I was downloading some charts from a site and after a few,
started wondering how many there were going to be. I got 404 errors at 100
and 90 (the charts were numbered like chart34.gif etc.). It turns out
there were about 80 to download. So rather than do this manually, I used
this script:
#!/usr/bin/perl -w
$u = 'http://www.someserver.com/chart';
use LWP::Simple;
for ($i = 1; $i < 84; $i++) {
$v = $u . $i . '.gif';
$f = 'chart' . $i . '.gif';
getstore($v,$f);
sleep 1;
}
The power comes from the LWP module, which permits me to download and
store a file with 2 lines of code, the rest is just the loop to form the
next file name (the . is a concatenation operator) and initialization.
An excellent resource for further info is http://www.perl.com/
Modules may be found on CPAN (http://www.perl.com/CPAN-local). HTH.
Cheers,
Jim
|