[Melbourne-pm] Scaling perl

ajthornton jdthornton at ozemail.com.au
Sat Oct 3 21:24:29 PDT 2009


 
P.s pasting from padre to perl to here messed up the code; but it still
works in padre. Perl. Maybe it has grown on me like a song that you don't
like until you've heard it a few times.  

-----Original Message-----
From: ajthornton [mailto:jdthornton at ozemail.com.au] 
Sent: Sunday, 4 October 2009 2:53 PM
To: 'melbourne-pm at pm.org'
Subject: Scaling perl


         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