lazy saunter

(personal learnings in computation)

Thursday, January 18, 2007

easing into perl now

basically, every project i am assigned can be done in PHP. as the limitations of PHP have been discussed in previous posts, i will spare mentioning them here, but am making this mention of non-mentioning in order to partially explain why, when i was assigned my latest project, i decided i would do it in perl.

i had once used perl to create a web-based "guestbook" page in which the user enters a comment and that comment and the time it was entered are written to a text file. the page shows the other comments in the file as well. another time (for my masters project) i used perl to fire off repeated executions of a java program taking different input parameters. the latter was a life-saver while the former was interesting but somewhat time-consuming and annoying.

now i am realizing that knowledge of perl can be very helpful to do all kinds of things within the linux file system and that it would be an important tool in any kind of scientific/mathematical related project (which would most likely run on linux).

perl has been around for a while and thus has stability on its side. the subset of function names to learn is small and includes functions to perform the same functions as PHP. however, when web design and processing are not involved, it seems perl is more popular. why this is, i am still not sure. possibly because of its strong support for regular expressions. better put, i want to know what and what tasks perl can do that PHP cannot (both can do system calls (both can grep i think)).

perl was created to process text and many system administration tasks come down to moving around in the file system and manipulating the names and contents of text files (though when i snoop around the files on our servers, our system administrator has written most of his sys admin stuff as bash shell scripts). perl is comparable to PHP in processing speed (or building optimized executable code).

for a couple of days i worked on my project that displays a menu, gets the users choice, reads a file into an array, processes the array, and writes this to a file. i learned the fundamentals of the language this way including writing subroutines with parameters and return values.

the next step is to find a good IDE to write perl stuff in (something a little more than vi).

1 Comments:

  • At 5:40 PM , Anonymous Anonymous said...

    Wow, sounds great - like you are really learning as you go. Good luck finding a good IDE! I dont know what to tell ya.

     

Post a Comment

Subscribe to Post Comments [Atom]

<< Home