Perl Books

B

Binny V A

Hello Everyone,

I have written a tutorial and would like to suggest a couple of good
Perl related books. But since I have little knowledge of perl books, I
have to come to you for aid. Would you recommend some good books for a
perl beginner.

The said tutorial is available at
http://www.geocities.com/binnyva/code/perl/tutorial/index.html
If you have any comment or suggestions about that tutorial, please
send it to me or post it in this group.

Thanking You,
Binny V A
http://www.geocities.com/binnyva
 
P

Paul Lalli

Binny V A said:
Hello Everyone,

I have written a tutorial and would like to suggest a couple of good
Perl related books. But since I have little knowledge of perl books, I
have to come to you for aid. Would you recommend some good books for a
perl beginner.

Have you seen http://learn.perl.org ?
Have you read `perldoc -q books` ?

In general, Programming Perl ("the Camel") is recommended as a
reference, and Learning Perl ("the Llama") and Learning Perl Objects,
References, and Modules are recommended as tutorials. I, personally,
concur wholeheartedly with those recommendations.
The said tutorial is available at
http://www.geocities.com/binnyva/code/perl/tutorial/index.html
If you have any comment or suggestions about that tutorial, please
send it to me or post it in this group.

I started reading it, but had to stop after the first few paragraphs of
"Syntax". Your spelling and grammar need a lot of work. If I have to
re-read every other sentence just to figure out what the sentence is
saying, I'm not going to be able to learn the information the tutorial
is trying to give.

A few comments on what I did see:

(Perl) is used as a CGI(Common Gateway Interface) language, Shell
Scripting Language, a programming language

No. Perl is a programming language. "CGI language" is rather
nonsensical. CGI is exactly what it stands for - an interface. *Any*
language can be used to implement that interface. "Shell Scripting
language" is simply wrong.

The #!/usr/local/bin/perl line. Put this in the most top of the
file. Line No 1. What does it do? You sure you want to know? Well it
tells the server that is running the script the locaiton of perl

What server? What makes you think a server is needed to run perl? Any
computer can run perl, whether it's used as a server or not.

The second thing is the semi-colon or ;. Put it at the end of every
statment.

Unneeded in some cases, incorrect in others. The semicolon is the
statement seperator, it is not needed at the last statement of a block.
Also, you haven't yet defined what a 'statement' is, so the absolute
beginner might believe semicolons are supposed to be placed after the }
of a block, for example.

Include as many comments as possible

Bad advice, IMO. Comments should be used to clarify the code. All too
often code is polluted with statements such as:

$i++; #increment $i

If the code itself makes it obvious what is happening, it doesn't
require an explicit comment. A better suggestion might be to comment
blocks or chunks of code, and comment individual statements only when
needed to ensure comprehension. This of course, is general to
programming, not specific to Perl.

You can use parentheses(brackets - ')')

Keep your terminology straight: (parentheses) [brackets] {braces}

Variables are words which has the '$' symbol at the start.

Imprecise. Scalar variables start with $. Other variables (array,
hash, typeglob) do not.


If you can get the spelling and grammar fixed, I might take another look
at the remainder of the tutorial.


Paul Lalli
 
U

Uri Guttman

BVA> I have written a tutorial and would like to suggest a couple of
BVA> good Perl related books. But since I have little knowledge of
BVA> perl books, I have to come to you for aid. Would you recommend
BVA> some good books for a perl beginner.

odd to have written a perl tutorial but not to have read any decent perl
books. what did you use to teach yourself perl?

BVA> The said tutorial is available at
BVA> http://www.geocities.com/binnyva/code/perl/tutorial/index.html
BVA> If you have any comment or suggestions about that tutorial, please
BVA> send it to me or post it in this group.

have you searched the web for other tutorials? have you noticed how bad
most of them are? i have read many and less than a handful are accurate
and well written.

ok, let's start with some quick comments.

you have done the common mistake of emphasizing perl is for cgi whereas
most perl coding is not cgi. shell programming is done with shells like
bourne, bash, etc. perl coding is NOT shell coding.

you do not need a 'server' to run perl scripts. that is cgi-centric
again which is wrongheaded.

most unix/linux platforms have perl but in many cases it is an outdated
version so recommending to install a fresh one would be a good idea.

you don't need syntax highlighting to edit perl. any decent text editor
will do.

1) The #!/usr/local/bin/perl line. Put this in the most top of the
file. Line No 1. What does it do? You sure you want to know? Well it
tells the server that is running the script the locaiton of perl. Now
there is a problem here. Some servers have perl in a different
location. So you have to find where the perl is located in your
server. Sometimes it will be #!/usr/bin/perl. Now if you are using
ActivePerl in Windows, the script will run without this line. But
just put it in anyway. Make it a habit.

again, perl does NOT NEED a server to run. stop saying that. and that
line is NOT perl syntax or anything to do with perl. it is a function of
unix and how it handles script files of which perl is just one type of
many.

3) Include as many comments as possible. One of the most noted
disadvangtages of perl is it bad redability. So if you want to
understand what you wrote today when you read it tommarow, you'd
better put comments where ever you can. Comments can be inluded with
the '#' charector. Rather harsh, don't you think? Sorry about the pun
- could'nt resist. This is the example of a comment...

# This is a comment
print "Hell World"; # Everything after the '#' is a comment

spellchecking would help a great deal. that paragraph is
unreadable. maybe some comments would help? as for including plenty of
comments that is misleading. bad code can be written in any language and
all code needs commenting. rule: code is what, comments are why.

and if your world is hell, then i am not sure i want to read your
tutorial. :)

6) Variables are words which has the '$' symbol at the start. They need
not be declared. But if you want a local scope varible use the
keyword 'my'. You can learn more about variables later.

bah!! use strict is important and it requires variables to be
declared. and calling lexical scope 'local' and mentioning 'my' is
extremely confusing as there is a 'local' declarator as well.

The second line shows how to output stuff. But what if we want
to get user input? $var = ; This statment will get data from
"Standard Input"(Keboard) and store the data in a variable
called '$var'. Please not the STDIN must be in capital letters.

where did <STDIN> go? it is in the html source. you should know to
encode < and > as entities.

The 'my' keyword can be used if you want a local variable. Don't
know what a local variable is? That's bad. Local variable is the
variable that exist only in the block that it is defined in.

that is so badly written and misleading.

in the operators section you show all the numeric comparison ops but
only eq and ne for strings.

you keep trying to make jokes but they are flat and inappropriate. stick
to accuracy and better writing first.

For Loop

This has been for long the favorite loop of many programmers I
know. For, what wouldn't a programmer give for for.

Syntax
for(initialization ; condition ; next) {
body
}

most decent perl coders rarely use c style for loops. foreach loops are
generally what is wanted as they are usually cleaner, faster and more
direct. but you haven't learned that yet it seems. funny how most
perl tutorial authors on the web don't know perl that well. they learn
some, get to like it and think they should help others but they don't
have the proper skills to write a quality tutorial.

sub plus
{
....
}

No Arguments! Does that mean that perl can't pass arguments? No,
it don't. The arguments of perl are stored in an array '@_'. Now
you will be asking what is '@_'. This is a predefined variable
in perl. These things have special meaning to perl. For example,
$_ will be used to store the arguments and default input. $!
will be used for error codes. There are many more predefined
variables in perl. As a matter of fact, most of the punctuation
has special meaning for perl. In this case, @_ stores the
arguments passed to the subroutine.

there is the usual misinformation about $_. why not at least point the
reader to perldoc perlvar? in fact you should always be referring the
reader to the perl docs for more (and accurate) info.

Wow! Three lines of code, Two pages of explanation. Sometime I
amaze even myself.

you amaze me all the time. terseness is a good writing skill to
learn. you cover so little of perl in so much verbiage.

#Get the input
if ($ENV{REQUEST_METHOD} eq 'POST') {
read(STDIN, $query_string, $ENV{CONTENT_LENGTH});
} else {
$query_string = $ENV{QUERY_STRING};
}

ok, that is the last straw. do you not even know about CGI.pm? do you
not realize the problems and bugs that homemade cgi parsers have?


and this straw breaks the camel's back.

Some places where great Perl Scripts are available...
http://www.geocities.com/binnyva/code/perl/ My own collection of Perl scripts that I wrote over the ages
http://cgi.resourceindex.com/ A huge collection of CGI Resources. CGI programs in perl and other languages.
http://www.scriptarchive.com/ Matt's Script Archive. Offering free CGI scripts to the web community

matt's scripts are an unholy mess and even he says that.

and i took a gander at your guestbook script. it has too many bugs and
too much bad code to even review. i will leave that to any others here
if they want the fun and glory.


i hope you had fun with this feedback and take it the right way. it
wasn't fun for me as i had to wade through another poor perl tutorial by
another self taught cgi kiddie. please get a some good books on perl and
study them as you have much to learn. using strict and CGI.pm are
probably the first things.

uri
 
R

Richard Gration

Hello Everyone,

I have written a tutorial and would like to suggest a couple of good
Perl related books. But since I have little knowledge of perl books, I
have to come to you for aid. Would you recommend some good books for a
perl beginner.

The said tutorial is available at
http://www.geocities.com/binnyva/code/perl/tutorial/index.html
If you have any comment or suggestions about that tutorial, please
send it to me or post it in this group.

Thanking You,
Binny V A
http://www.geocities.com/binnyva

I'll leave it up to more knowledgeable people to critique your tutorial,
but I wanted to point out that when you mention <STDIN> you should write
it as &gt;STDIN&lt; in web pages.

Rich
 
S

Sherm Pendley

Binny said:
The said tutorial is available at

(URL deleted to protect the innocent.)

First off - kudos for the intent. I mean that. You obviously want to
help people, and that's a good thing.

As for the execution, well, that leaves a lot to be desired. To be
honest, you - and more importantly, the people you want to help - would
be better off *learning* more Perl before you attempt to teach anyone.
Your tutorial is *loaded* with misconceptions, vagaries, and downright
errors.

If you *really* want to help people, take your tutorial down, and
replace it with a simple link to <http://learn.perl.org>.

sherm--
 
P

Peter Scott

Hello Everyone,

I have written a tutorial and would like to suggest a couple of good
Perl related books. But since I have little knowledge of perl books, I
have to come to you for aid. Would you recommend some good books for a
perl beginner.

The said tutorial is available at
http://www.geocities.com/binnyva/code/perl/tutorial/index.html
If you have any comment or suggestions about that tutorial, please
send it to me or post it in this group.

Wanting to be a writer and to teach Perl are two honorable
goals (notwithstanding retorts of "Well, you *would* say that,
wouldn't you?" :). Unfortunately you have so far to go in
meeting either one that commenting on specific technical
inaccuracies in your opus is not what you need most right now.

First of all, become a lot more proficient in English prose,
or use a language you're more fluent in. Teaching is an act
of communication and you can't be a good teacher without
communicating well at all levels.
Secondly, learn more about Perl so you don't make so many
technical mistakes. Get the fundamentals down cold.
Understand the terminology and be ruthless about using
it correctly.

So before you ask what Perl-related books you should be
recommending, you should be reading a bunch of them,
and in the meantime, replace your tutorial with a
pointer to something that's already acknowledged to be
a useful resource for beginners.
 
M

Matt Garrish

Paul Lalli said:
If you can get the spelling and grammar fixed, I might take another look
at the remainder of the tutorial.

Couldn't agree more. I particularly liked this gem:

One of the most noted disadvangtages of perl is it bad redability.

Matt
 
A

A. Sinan Unur

BVA> I have written a tutorial and would like to suggest a couple of

From http://www.geocities.com/binnyva/code/perl/:

<quotation>
I have written a good tutorial for CGI Perl.
</quotation>

I find this statement astonishing in its lack of humility given that BVA
does not even know of any good Perl books to recommend.
and this straw breaks the camel's back.

Some places where great Perl Scripts are available...
http://www.geocities.com/binnyva/code/perl/
....

and i took a gander at your guestbook script. it has too many bugs and
too much bad code to even review. i will leave that to any others here
if they want the fun and glory.

The quotation from BVA's web site provided enough motivation for me to
take a look at the guestbook script. Here are a few points:

use strict;
use warnings;

missing.
# Get input
my $value;
if ($ENV{'REQUEST_METHOD'} eq "GET")
{
$value = $ENV{'QUERY_STRING'};
}
# else {
# $value = <STDIN>;
# }

Have you heard of CGI.pm?
# Take time to make things happen

Non-sensical comments like this are worse than no comments at all.
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime(time);

First, you are not using all the values returned by localtime. So, assign
only those you need:

my ($mday, $mon, $year) = (localtime(time))[3,4,5];
$year = $year - 100;

Second, the correct way to handle the year value returned by localtime is
shown in perldoc -f localtime.
$mon++;
$date = "$mday$seperator$mon$seperator 200$year";

Incidentally, the correct spelling is separator.

What does this print on 1 December 2010? Let's see:

use strict;
use warnings;

my $mday = 1;
my $mon = 12;
my $year = 110 - 100;
my $separator = '-';

print "$mday$separator$mon$separator 200$year";

__END__

C:\Home> tttt
1-12- 20010

Oh, ain't that a beauty?

use strict;
use warnings;

my $separator = '-';
my ($mday, $mon, $year) = (localtime(time))[3,4,5];
$mon += 1;
$year += 1900;

my $date = "$mday$separator$mon$separator$year";
print $date;

Not that I recommend this method formatting dates. Quick, is 1-12-2004
January 12th or December 1st?
# Making the input English. And removing unwanted things

Again, nonsensical comments are worse than no comments at all.
$value =~ s/%(..)/pack("c", hex($1))/ge;
$value =~ s/name\=//gi;
$value =~ s/email\=//gi;
$value =~ s/loc\=//gi;
$value =~ s/comments\=//gi;
$value =~ s/rating\=//gi;
$value =~ s/strength\=//gi;
$value =~ s/\+/ /gi;
$value =~ s/\n/<BR>/gi;

Why did you do that to the query string?
# Catogarizing the input

Non-sensical comments are worse than no comments at all.
@value = split(/&/, "$value");

Useless use of quotes.
$name = $value[0];
$email = $value[1];
$location = $value[2];
$comments = $value[3];
$rating = $value[5];
$strength = $value[6];

I see what you are doing now and I am horrified. This is very fragile.
Your technique (aside from other flaws) relies on variables appearing in
a specific order within the query string.

At this point, your best bet is to use CGI.pm.
# Open Guest Book File
open (FILE, "$guestfile") || print "Can't open $guestfile: $!\n";

Tears in my eyes ... So, if you fail to open the file you want read from,
you react by printing a message to STDOUT
@LINES=<FILE>;

and then reading from the file. Sweet!

# Open Guest Book File and inputing the content on top
open (FILE, ">$guestfile") || print "Can't open $guestfile: $!\n";

So, if you fail to open the file you want to write to, you react by
printing a message on STDOUT
for ($i = 0; $i <= $SIZE; $i++)
{
$_=$LINES[$i];
if (/<!--top-->/)
{
print FILE "<!--top-->\n";

And then writing to an invalid file handle anyway. Double sweet!!!

Furthermore, you have no idea how to loop through invidual elements of an
array.

for (@LINES) {

# do something with each line

}

In short, you should scrap this script and go back to learning Perl.
 
J

Jay Tilton

(e-mail address removed) (Binny V A) wrote:

: I have written a tutorial

Writing is more than just typing.

Write for your audience. Your audience will be people with minimal
experience with Perl, or even minimal experience with any sort of
programming. They will value accurate information that is presented
quickly. This draft of your tutorial is excessively verbose,
inappropriately casual, and it is peppered with countless errors.

Text that is unreadable is not going to be read. Spelling, grammar, and
punctuation matter more than you might think.

Writing is not a one-person job. Run the text through the review/revise
cycle a few dozen times with a cooperative expert.

Test your sample programs. More than one of them does something different
than it should.
 
U

Uri Guttman

me thinks we scare the kid away. he asked for feedback and help and
didn't seem to be able to handle the results. be careful what you ask
for. now the question is will he learn from this and learn more perl? as
other have stated english is probably not his first language so will he
write in his native language? is there demand in that language for perl
help (or at least decent perl help)?

i always wonder how people like this learn perl in a vacuum and think
they actually know it. he kept refering to other languages (which isn't
always a good idea, assuming your reader know those langs) as if he knew
them well too. generally if you are very good at coding in one lang it
isn't hard to learn others. those who can't code well in one are usually
bad in all :).

oh well. we must have burst his bubble.

uri
 
S

Sherm Pendley

Uri said:
now the question is will he learn from this and learn more perl?

Doubtful. He'll probably just go cry in aother forum about how "mean"
those "Perl people" were to him. It's amazing how many people can't tell
the difference between honesty and hostility.
he kept refering to other languages (which isn't
always a good idea, assuming your reader know those langs)

I agree, it's not ideal - but we should be careful about throwing stones
here. The official docs are guilty of that too, they often refer to
shell and C.

sherm--
 
U

Uri Guttman

SP> I agree, it's not ideal - but we should be careful about throwing
SP> stones here. The official docs are guilty of that too, they often
SP> refer to shell and C.

but that is legit since perl derives much from those langs and it is
useful to point that out and such. but bringing c++ into it is silly as
perl has nothing from that (thankfully).

uri
 
B

Binny V A

Hi Everybody,

I am the author of the said
tutorial(http://www.geocities.com/binnyva/code/perl/tutorial/index.html).
I must apologize for my errors. But then again you must see my
point of view also. I have written a tutorial DON'T mean that
I have completed the tutorial. A lot of polishing has to be
done before completing it.

But I am to blame for most of the errors. Making spelling mistakes
the age of spell checkers are without excuse. So are many other
mistakes that were made by me.

As many of you have already gussed, I am not a english is not my
native tounge. So I am entitlled to a few errors.

Anyway, thanks for the feedback. I will try to polish and then
publish the tutorial. If some of you could help me by proofreading
and by posting your suggetions, I would be very grateful.

One good thing is that I have learnt the meaning of the pharse
"If you really want to make an impression about something,
do it wrong." ;-)

Once again thanking you,

Binny V A
http://www.geocities.com/binnyva
 
U

Uri Guttman

BVA> Anyway, thanks for the feedback. I will try to polish and then
BVA> publish the tutorial. If some of you could help me by proofreading
BVA> and by posting your suggetions, I would be very grateful.

my main suggestion is that you don't try to write a tutorial at all. it
is much more difficult than you realize especially if you are not
writing it in your native language. it is admirable that you tried and
you will actually get more respect from me if you stop working on
it. you have so much perl to learn before you could even think about
doing this well. even people who know perl very well have trouble
writing books and tutorials. technical writing is a very difficult skill
to master.

BVA> One good thing is that I have learnt the meaning of the pharse
BVA> "If you really want to make an impression about something,
BVA> do it wrong." ;-)

and what makes you think that you can do it right? and when? not any
time soon IMO. please just drop it for your sake and for those who may
stumble upon your page. it is better to have no tutorial than one full
of mistakes. learn the lesson of matt's scripts where he was first and
too many kiddies copied his broken code for many years.

uri
 
M

Michele Dondi

point of view also. I have written a tutorial DON'T mean that
I have completed the tutorial. A lot of polishing has to be

"I have written a tutorial" DOESN'T mean "I have completed the
tutorial".

"I have written a tutorial" ne "I have completed the tutorial".
(perlish)

The fact that I have written a tutorial DOESN'T mean that I have
completed it.


Not a native English speaker either,
Michele
 
P

Paul Arthur

"I have written a tutorial" DOESN'T mean "I have completed the
tutorial".

"I have written a tutorial" ne "I have completed the tutorial".
(perlish)

The fact that I have written a tutorial DOESN'T mean that I have
completed it.

Or even "The fact that I am writing a tutorial DOESN'T mean that I
have completed it." Phrasing it in the past tense does, in fact,
imply that it is a completed process.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top