Showing posts with label Perl. Show all posts
Showing posts with label Perl. Show all posts

Tuesday, April 15, 2008

Stack:
Stack is a important data structure In Perl programming, and can be implemented using LIFO technique. i.e., the Last thing In is the First thing Out. So from the above demonstration(refer Figure 1.1), it's learnt that Stacks can be implemented using PUSH and POP commands.

Queue:
The queue is another data structure. A physical analogy for a queue is a line at a bank. When you go to the bank, customers go to the rear (end) of the line and customers come off of the line (i.e., are serviced) from the front of the line. So from the above demonstration(refer Figure 1.1), we can say that Queues can be implemented using PUSH and SHIFT.

Subroutines in Perl

There are three different formats to be used for calling the subroutines/methods,
"hello" is the subroutine name, say

1) &hello;
Subroutine definition can be made anywhere in the file.
& is to tell compiler that, hello is a subroutine.

2) hello();
Subroutine definition can be made anywhere in the file.
() is tell compiler that, hello is a subroutine.

3) hello;
Subroutine definitions should be made before invocation
If you have a subroutine definition after the invocation; at least you need to declare it with "sub hello;" before invocation.
here sub is tell compiler that, there would be a subroutine named hello anywhere in the file.

Friday, June 22, 2007

Perl Newsgroups

Wondering! Where to post your queries regarding perl?
Here is the list of top perl newsgroups. I bet your issues will be best addressed in one of these newsgroups depending upon your issue.

Thursday, June 21, 2007

Inter process communication(IPC)

IPC

Interprocess Communication in perl (IPC)

To maximize portability, don't try to launch new processes. That means you should avoid system, exec, fork, pipe, ``, qx//, or open with a |.

The main problem is not the operators themselves; commands that launch external processes are generally supported on most platforms (though some do not support any type of forking). Problems are more likely to arise when you invoke external programs that have names, locations, output, or argument semantics that vary across platforms.

One especially popular bit of Perl code is opening a pipe to sendmail so that your programs can send mail:

open(MAIL, '|/usr/lib/sendmail -t') or die "cannot fork sendmail: $!";
This won't work on platforms without sendmail. For a portable solution, use one of the CPAN modules to send your mail, such as Mail::Mailer and Mail::Send in the MailTools distribution, or Mail::Sendmail.

The Unix System V IPC functions (msg*(), sem*(), shm*()) are not always available, even on some Unix platforms.

For general information on IPC.
Part - I
Part - II

Wednesday, March 14, 2007

Perl titles

1)
Programming Perl By Larry Wall, Tom Christiansen, Jon Orwant

2)

Perl Cookbook By Tom Christiansen, Nathan Torkington

3)

Perl Best Practices By Damian Conway

4)

Learning Perl By Randal L. Schwartz, Tom Phoenix

5)

Advanced Perl Programming By Simon Cozens

6)

Intermediate Perl By Randal L. Schwartz, Brian D. Foy, Tom Phoenix

7)

Perl Hacks: Tips & Tools for Programming, Debugging, and Surviving By Chromatic, Curtis Poe, Damian Conway