Practical Extraction Recording Language

U

Uri Guttman

ASU> Just for laughs:
ASU> http://www.unc.edu/~husted/Work/PerlReference.htm#anchor8

The following elements are symbols and special variables that
are very important in Perl. You should know and understand the
function of these. They are special and have been set aside for
specific use by the program.

#! - This symbol tells the kernel what program is
interpreting the script. It will be followed by the path
name. In our case, the first line of every Perl script will
be #!/usr/bin/perl.

hahahhahah!!!! what a wacked out explanation of #!. first he says it is
a perl symbol and then he says it is used by the kernel.

; - The semicolon is the part of Perl language that terminates a
statement. A perl statement is an expression or series of
expressions that will not be executed without the semicolon.

huh??? perl -e 'print "the author is a doofus\n"'

don't see no ; there!

Chop or Chomp ? The chop and chomp function take off the last
character of a string or variable. For our intents and purposes,
they can be used interchangeably. They are usually used to take
off the return of a standard input (from the keyboard) so that
it is not read as part of a variable.

this is getting worse and worse. where do these perl tutorial authors
get their nonsense from? it just supports my creed that almost all perl
web tutes are crap. i can still only think of a handful (from dozens!)
that are decent.

Defined Expression ? The defined function returns a Boolean
value of 1 when an expression has a real value and 0 when it
does not. It allows you to check the validity of variables. This
is useful for understanding where a fatal error is coming from.

????? if it is a fatal error, how can defined even get called?

Die ? The die function is used if a call to open function
fails. For instance, if the user types the wrong file name for
the data file that is being filtered, a die function can be used
to stop the program from progressing. It exits the Perl script
with the value of $! and prints a message to the STDERR.

hmm, die can only be used with open?

Evaluate ? The eval function allows the user to check for errors
in the Perl script. It evaluates an expression and the errors
are returned to the $@ variable.

hmm, conflating eval string vs eval block. i wouldn't have expected
anything else from this page.

Join ? The join function converts a LIST of variables to an
array separated by a delimiter specified by EXPR.

that is a winner!

plenty of more poorly worded stuff. then i find this gem:

Quotes effect almost everything you do in Perl and are used
especially when printing a string of words. The three kinds of
quotes are single (' '), double (" "), or backslashes (\ \).

backslashes are quotes? and in pairs? can someone point me to the docs
for this? more on this:

Backslashes can be used only to quote a single character. A
single backslash can be used to tell the program not to read a
special Perl character as such. For instance, if you want to use
a dollar sign in your output, you would put \$ in your script so
that Perl would not think you were introducing a variable.

wow. print \$foo ;

there is no mention of context anywhere especially for those funcs and
ops where it matters (e.g. check out reverse)


These terms along and much of the material in this Perl Tutorial
can be found in the book Perl by Example written by Ellie
Quigley (1995). I have chosen the terms applicable to scientific
data filtering using Perl in an attempt to facilitate
learning. This tutorial was written for the participants of the
National Science Foundation grant REVITALISE for educational
purposes only.

that is an infamously bad perl book and amazingly out of date. so he
plagiarized a bad book and was paid for it?

Links:

ActiveState - This link will take you to ActiveState's Perl
page. Here you can download the correct version of Perl for
your machine as well as find a plethora of other useful
information.

so activestate is the center of the perl universe. that is the only link
in that section. and consider that the #! crap is unix only but he
refers to a winblows oriented perl (yes, i know they have unix versions
but who uses those?).

it opens with:

Lindsay Husted, presently an undergraduate at the University of
North Carolina and an NSF appointee, built this site.

the last modified time is:

06/16/04 15:20:44

this page is mind boggling. if someone can find an email address, feel
free to forward my critique.

uri
 
A

Ala Qumsieh

Uri said:

[snip valid critique]
this page is mind boggling. if someone can find an email address, feel
free to forward my critique.

I'm totally surprised you actually went through the whole page! I just
couldn't go on after the first few paragraphs. Things like this should
be illegal!

DIRHANDLE - This is the name of the directory.

huh?

KEY - The numeric identification assigned to each element of an
associative array (usually starts at one and counts up).
VALUE - The non-numeric identification assigned to each element of
an associative array.

So keys have to be numeric and values have to be non-numeric? Later on,
he (fortunately) contradicts himself:

ASSOC - A variable that contains a list of values that is indexed by
a string. It is preceded by the % symbol. Its individual elements are
scalar.

STRING - Non-numerical variable (perhaps a list of words)

Why non-numeric?

I just couldn't go on any further. The worst Perl tutorial I've seen by far.

--Ala
 
A

Anno Siegel

Ala Qumsieh said:
Uri said:

[snip valid critique]
this page is mind boggling. if someone can find an email address, feel
free to forward my critique.

I'm totally surprised you actually went through the whole page! I just
couldn't go on after the first few paragraphs. Things like this should
be illegal!

What I find fascinating is how the author combines incompetence with
the tone of authority. The young woman ("Lindsay Husted, presently an
undergraduate...") obviously writes about things she doesn't understand.
But no sign of insecurity enters the writing even at its most nonsensical.

At some point, incompetence impairs a person's ability to perceive it.

Anno
 
O

Octo Mancer

What I find fascinating is how the author combines incompetence with
the tone of authority. The young woman ("Lindsay Husted, presently an
undergraduate...") obviously writes about things she doesn't understand.
But no sign of insecurity enters the writing even at its most nonsensical.

I agree. There is never any hint in the writing that the author knows they
are creating the most dangerous kind of instruction - half truth mixed
with complete tosh (reminiscent of some religious texts).

My personal favourite:

"It uses a combination of shell, awk, sed, grep, and C languages. It was
created by Larry Wall and is a GNU product, which means it is FREE."

I challenge anyone to cram so many fallacies into so few words!!! This
sentence caused me to think the whole page was intentional comedy, but by
the end of the next section the horrible truth had dawned.

R
 
U

Uri Guttman

AS> What I find fascinating is how the author combines incompetence
AS> with the tone of authority. The young woman ("Lindsay Husted,
AS> presently an undergraduate...") obviously writes about things she
AS> doesn't understand. But no sign of insecurity enters the writing
AS> even at its most nonsensical.

AS> At some point, incompetence impairs a person's ability to perceive it.

i did find a page of contacts for the 'leaders' of this 'revitalize'
program and sent an email to the one from her school. i eagerly await an
answer (got a vacation reply so it is valid!). that this was funded by
the NSF was the biggest insult. they should just pour money into TPF
instead.

and as someone else said this is about the worst perl tute i have ever
seen. it is so wrong in so many ways. we should keep an archive copy
around before the author deletes it (now that is has been discovered by
the real perl community and ridiculed).

uri
 
E

el_roachmeister

As someone who has been programming in perl for several years, I found
the site useful. It was simple and well organized and I picked up
several new tips to add to my "arsenal". Yeah, it may not be 100%
accurate, but perl is about getting the job done, not about splitting
hairs.

Next time you insult someone's work, why dont you post a link of your
own tutorial? Don't have one, I didnt think so.
 
A

A. Sinan Unur

(e-mail address removed) wrote in

[ top posting corrected ... please do not do that
It seems like it is your first time posting here so
please go ahead and read the posting guidelines.
]
As someone who has been programming in perl for several years, I found
the site useful.

If that is the case, then you might find http://learn.perl.org/ even
more useful.

Sinan.
 
T

Tad McClellan

Uri Guttman said:
ASU> Just for laughs:
ASU> http://www.unc.edu/~husted/Work/PerlReference.htm#anchor8

; - The semicolon is the part of Perl language that terminates a
statement. A perl statement is an expression or series of
expressions that will not be executed without the semicolon.

huh??? perl -e 'print "the author is a doofus\n"'

don't see no ; there!


Just so that we might realize some practical value from shredding
the bullshit that is that "reference" page, let's learn about the role
of semicolon.

In most languages the semicolon is a "statement terminator" so it
must terminate each statement.

It is not like that in Perl.

In Perl the semicolon is a "statement separator" so it is only
needed when you have 2 statements that need "separating".

This is why the final semicolon in any block is optional in Perl.
You leave it off at the end, or if you put it in, you are really
inserting an "empty statement" (which has no effect) after the
final (visible) statement.

this page is mind boggling.


It really packed in the grins-per-sentence, I feel better after
a humor break like that.

Thanks for posting the link Sinan, it was a real hoot!
 
A

A. Sinan Unur

Thanks for posting the link Sinan, it was a real hoot!

You are welcome. I had googled for something and it came up second or third
so I decided to follow the link. It took a while for my initial reaction to
subside and then I realized it might be appreciated over here.

Sinan.
 
M

Matt Garrish

As someone who has been programming in perl for several years, I found
the site useful. It was simple and well organized and I picked up
several new tips to add to my "arsenal". Yeah, it may not be 100%
accurate, but perl is about getting the job done, not about splitting
hairs.

Care to elaborate on what you found useful on that site?
Next time you insult someone's work, why dont you post a link of your
own tutorial? Don't have one, I didnt think so.

The people who post here know better than to rewrite the docs, but if you
really like links:

www.perldoc.com

Starting people off with false information and bad coding practices in the
interest of not "splitting hairs" is not justification for writing a bad
tutorial. It's harder to break a bad habit than to learn something right the
first time. Worse, someone who believes information like that is
authoritative may not discover for a long time just how uninformed they are.

Matt
 
U

Uri Guttman

ASU> You are welcome. I had googled for something and it came up
ASU> second or third so I decided to follow the link. It took a while
ASU> for my initial reaction to subside and then I realized it might
ASU> be appreciated over here.

thanx from me too. i enjoy shredding pages like that. i do code review
for work when i can and doc review is similar. i wouldn't have the
energy to write a proper tute/book (and there are good ones out there)
but it is much easier to do critiques. this was the easiest critique i
have ever done. i was having trouble finding stuff that didn't have
blatant errors or stupidities.

uri
 
U

Uri Guttman

er> As someone who has been programming in perl for several years, I found
er> the site useful. It was simple and well organized and I picked up
er> several new tips to add to my "arsenal". Yeah, it may not be 100%
er> accurate, but perl is about getting the job done, not about splitting
er> hairs.

100%?? more like it was right about 20%. the mistakes and errors and
misstatements were legion. the organization made no sense (like i said,
context was never mentioned).

er> Next time you insult someone's work, why dont you post a link of
er> your own tutorial? Don't have one, I didnt think so.

why? there are several good ones out amongst the dozens of bad ones. it
would be better to point newbies to the good ones (and ridiculing the
bad ones) rather than writing one.

uri
 
T

Tintin

As someone who has been programming in perl for several years, I found
the site useful. It was simple and well organized and I picked up
several new tips to add to my "arsenal". Yeah, it may not be 100%
accurate, but perl is about getting the job done, not about splitting
hairs.

Virtually all programming languages are precise in their syntax. You just
can't use random stuff and expect it to work.

What happens when a novice Perl programmer comes along a read a tutorial
that's full of errors, misinformation and misleading statements. That's
hardly going to enable them to "gettting the job done".
 
P

Peter Wyzl

A. Sinan Unur said:

Since the tutorial has been critiqued widely, perhaps some of her code
too...

From http://www.unc.edu/~husted/Work/password.txt#!/usr/bin/perl
#Lindsay Husted
#password.pl
#July 10, 2003
#this program generates a random password
#
#Generate a random number
print "Enter a seed number: ";
$seed = <STDIN>;
chomp $seed;
srand($seed ^ time);
#Set up a list of consonants and vowels
@consonants= split(/ */, "bcdfghjklmnpqrstvwxyz");
@vowels= split (/ */, "\@310u");
#Loop through the generation of a password
for ($i=1; $i<=4; $i +=1) {
print $consonants[int(rand(21))],
$vowels[int(rand(5))];
}
#EOFFrom http://www.unc.edu/~husted/Work/literals.perl.txt#!/usr/bin/perl
#Program, named literals.perl, written to test special literals
print "We are on line number ",__LINE__,".\n"; #Returns line number
print "The name of this file is ",__FILE__,".\n"; #Returns file name
__END__

#Must use a double underscore at the front and back of the word
_____-- Wyzelli${^__}=[qw(Just another Perl Hacker)];print "@{[@{${^__}}]}";
 
A

A. Sinan Unur

Since the tutorial has been critiqued widely, perhaps some of her code
too...

Why not try it yourself. At each line, ask if ther is a better way to do
it.
#Generate a random number
print "Enter a seed number: ";
$seed = <STDIN>;
chomp $seed;
srand($seed ^ time);

Since the user cannot reproduce the same password even when she knows the
seed, what is the use of asking the user to enter the seed. Either the
seed should be used unmodified (as a forgotten password retrieval
mechanism, maybe?) or the default seed should be used. See Abigail's
responses in http://tinyurl.com/6npm6.

So, the script needs to start with:

use strict;
use warnings;
#Set up a list of consonants and vowels
@consonants= split(/ */, "bcdfghjklmnpqrstvwxyz");

There is no point to this, really.

my @consonants= qw'b c d f g h j k l m n p q r s t v w x y z';

On the other hand, if one just has to use split, say what you mean:

my @consonants= split //, 'bcdfghjklmnpqrstvwxyz';
@vowels= split (/ */, "\@310u");

Same deal.

my @vowels= qw'@ 3 1 0 u';
#Loop through the generation of a password
for ($i=1; $i<=4; $i +=1) {
print $consonants[int(rand(21))],
$vowels[int(rand(5))];
}

Since the loop index is not used at all, this can be written as:

print $consonants[int(rand(21))], $vowels[int(rand(5))] for (1 .. 4);

However, 'z' will never be picked in this scheme.

Sinan.
 

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,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top