[Melbourne-pm] Scaling perl

ajthornton jdthornton at ozemail.com.au
Sat Oct 3 20:53:21 PDT 2009


         Hello
              OK, I kept my promise to try to enjoy perl. I looked up some
tutorials on text processing and cut and paste ane xample, before playing
with it and coming up with:

             #!/usr/bin/perl

$str = "The 34567744444444 foxes jumped over the ripe yellow pumpkin";
$str2= "The spaceman is a mutt in a spiderman suit";
$str3= "Melbourne Storm";
$comma = ',';
# returns ?
print length ($str);
print $comma;
print length ($str2);
print $comma;
print length ($str3);



IN Padre this runs; it's a correct program. It returns 60,42,15 

The original example had only str and did not put output between commas; I
nutted those things out. But imagine if there were more $str say up to
$str20000000000000 or whatever. Then it becomes bad to write print $comma;
that many times!!!!!!!!! What a waste. Also better, come to think of it,
would be to put the string lines in what I call a series [once a msths grad,
always a maths grad] , say print length ($str...+ 1...$str2000000) to give a
series of strings to be printed. [I expect that that example is nonsense;
just made it up - I was trying to do the same thing that from memory is done
in Python but in that you use i= or something] Then we could run a huge
program with very little sourcecode to write.

In short, for "real world" size tasks as above would the sourcecode be
scalable? If so , how? Am I on the right track?

I am enjoying perl! :)  

John   




More information about the Melbourne-pm mailing list