[Ilugc] [TIP] perl tutorial 0

  • From: suraj@xxxxxxxxxxxxx (Suraj Kumar)
  • Date: Fri, 2 Dec 2011 11:06:04 +0530

On Fri, Dec 2, 2011 at 5:44 AM, Girish Venkatachalam <
girishvenkatachalam at gmail.com> wrote:


Though perl is not as good as python in many ways for some reason perl
has a very strong developer community around it. It has
got a certain way to obtain copious documentation in UNIX man page format.


perl is not as good as python? Good lord, I got not the time for this flame
bait.



And perl's UNIX focus lies in its manpage format for documentation
unlike python's help(<module>)


perl's documentation is not in the manpage format. Perl's document is
written in the "POD" format (for "Plain Old Documentation"). It is possible
to obtain the documentation using perldoc (not man) and pod easily gives
way to turning the same documentation into any format. Yes, its a big
advantage, but its not "just" man pages. Given man's popularity and
familiarity, for the sake of convenience, some package maintainers choose
to also turn the pod documentation into man.



 style, though every language has OS bindings perl is a direct copy
when it comes to regex, its


Could you please explain what you mean by "perl is a direct copy when it
comes to regex"?



 IPC and so on. It is nothing but UNIX in a new flavor.


Perl is a language with an interpreter on top of Unix-like OSes (and
windows and mac and many others including real-time embedded OSes). Perl is
not an OS. the OS is below perl and does all the hard-lifting, but perl, as
do all languages, attempts to let the programmer write an elaborate recipe
of achieving something by manipulating the OS underneath, without us having
to know about the internals (of interacting with the OS).

So it is confusing when you say that the driver is the vehicle, ie., perl
is the OS.

[snip]

Depending on whether the lvalue is singular or plural(scalar or
array), the RHS will be assigned
 as the length of the RHS or the list in the RHS itself.


Err...



For instance, if you write,

$sca = (1,3,4,5);

You will see that $sca contains 4.

$ perl -e '$sca = (1,2,3,4); print $sca;'
4$


$ perl -e '$s = (1,3,5,6); print $s'
6

Oops.

Its not the length of the array. Its the last element in the array.



But if you do this:

@a = (1,2,3,4);

you will be able to assign the whole array.

This can trip many people, even experienced programmers. One can even
argue it is a bug.


Everything requires a certain approach to learning, learning to deal with a
dog is very different from dealing with a dragon. But there are obvious
differences in end applications for the two. The question is whether you
have learnt that approach fully well and can explain the same to everyone.
It is not very helpful to make sweeping statements that only point out
problems without providing solutions.

Regards,

  -Suraj

-- 
Career Gear - Industry Driven Talent Factory

Other related posts: