It calculates a Morris sequence of numbers. This is also called the “look and say” sequence. For example, if the first number is 1, then the second number is 11, because there is one one in the previous element. Then the next number in the sequence would be 21, because there are two ones. Etc.
(Sorry, deleted the code because it was getting all messed up, even wrapped in pre tags. It’s… here http://kaishaku.diaryland.com/090129_39.html )
Jan 28, 09:13PM PST | 0 comments
Example:
sub sum_of_list
{
my $total;
foreach(@_)
{
$total += $_;
}
$total;
}
And that will return the sum of a list of numbers. What’s friggin’ awesome about it? It works with any number of parameters. Perl’s handling of lists is awesome in this respect. You can do:
sum_of_list(1, 3, 5, 7, 9); or
sum_of_list(qw/1 3 5 7 9/); or even
sum_of_list(1..100);
So, pretty much loving it so far.
Jan 24, 2009, 01:16AM PST | 0 comments
I received my copy of Learning Perl a couple days ago. Yesterday I was cleaning out the bookshelf to make room for the lady friend’s stuff, and I find … Learning Perl. I knew I had read it before but I thought it was a library copy. At least the new one is the 3rd edition and the old one is 1st. I’m keeping them both to remind myself of my stupidity.
Jan 06, 2009, 01:15AM PST | 0 comments
Using regex! It worked and was possibly even partially non-retarded.
Dec 31, 2008, 06:17PM PST | 0 comments
Learning Perl by Schwartz & Phoenix was available on half.com for 75 cents plus shipping. I snatched it up.
Dec 27, 2008, 08:16PM PST | 0 comments
I read the Larry Wall book about 12 or 15 years ago, but it didn’t sink in permanently because I never did much scripting. Nowadays I sometimes find myself doing something where a perl script would have suited excellently, but my inexperience in perl causes me to usually write it in C or Java (as overkill as that may be).
I considered other scripting possibilities:
- JavaScript? I dig the first-class functions but it’s too web-oriented
- PHP? Suffers the same negatives
- Lisp or Scheme? Probably too theoretical for me.
So, I think I’ll have to hit the library again for that perl book.
Nov 03, 2008, 08:20PM PST | 0 comments
I got the book Beginning Perl for Bioinformatics by O’Reilly. I am on chapter 5 now, and it is a good book. It teaches perl in the context of how it can be used for biology, which is great for me. I am a bio student, and the examples in this book are far more interesting than the problems in other programming books. It is much more exciting to me.
I’m glad to be getting started with this. I like perl. I have always loved Python, although Perl is great too. It is hard to say which one I like more. They are about the same level of difficulty, but Perl is better for handling text data. I guess the choice just depends on what you want to do.
May 19, 2008, 10:01PM PDT | 0 comments
It is about right time to start studying Perl.
Feb 20, 2008, 06:57PM PST | 1 comment
nitin09 is working ...... eventhough feeling down
Found it be great book …...... and completed almost it. Can i now say i am a Perl programmer ??? !
Jan 11, 2008, 11:50AM PST | 1 cheer | 1 comment
I´m not a profession programer, but I need to start programing, soo I learn Perl, but I want to learn and practice more, soo I keep programing (or almost I want to)
Dec 08, 2007, 11:12AM PST | 0 comments