Re: Trouble running a unix command with a subroutine call
- From: "Purl Gurl" <purlgurl@xxxxxxxxxxxx>
- Date: Fri, 25 Nov 2005 03:50:31 GMT
Purl Gurl wrote:
> "Do not blindly assume all to be right."
"Not only does the & form make the argument list optional, but it also disables any prototype checking
on the arguments you do provide. This is partly for historical reasons, and partly for having a convenient
way to cheat if you know what you're doing. See the section on "Prototypes" later in this chapter."
- Programming Perl, Schwartz, Christiansen & Wall
Those three are indicating, "...if you know what you are doing."
The hidden message of this FAQ author is,
"I do not want you to know what you are doing. You are to do what I tell you. My way is the only right way."
That attitude is expressed here daily, and has been expressed here for years and years.
Those who express that attitude, I immediately dismiss as mindless minions.
Who does not display that attitude? MOI, the most infamous and most imaginative Perl programmer ever!
Who is constantly trolled, insulted and told to be wrong? That would be me, of course! Why does this
happen? Because I am a talented and imaginative Perl programmer who threatens the egos of others,
if not cause those others to be insanely jealous of my skills.
Do I always get "it" right? NO.
To whom do I owe my beginnings in Perl? Randal Schwartz who is as much of a rebel as I.
During all my years of Perl programming, not once have I used subroutine() syntax.
I always use &subroutine() syntax. I have found &subroutine() syntax to be safer,
less prone to error and significantly more convenient. Is my method right for all? NO.
Is my method right for all circumstances? NO.
Nonetheless, I find the author of this FAQ to be intellectually insulting by his indicating
my method is wrong, especially after successfully using my method for over a decade.
Perhaps it is, I know what I am doing and the FAQ author does not?
So, which is better? Knowing what you are doing or blindly doing what another tells you to do?
Here is a simplified example of what can happen
when a Perl FAQ imparts bad information.
Pretend this is a case example of a need to perform
a series of complex mathematical calculations with
a single input number. Maybe sine, cosine, geometry,
trigonometry, calculus, whatever.
You want to calculate a variety of results based on
a single number input.
Run this sample script and question,
"Which syntax is best for these specific circumstances?"
"Does this FAQ impart all information needed?"
"Which syntax is more programmer error prone?"
"What the Hades happened?"
"Why does this FAQ not warn about what happened?"
"Why does this FAQ indicate to not use what works best?"
Purl Gurl
* There are deliberate syntax errors; don't bother trolling me on those
* but rather think, instead.
#!perl
@_ = (1);
×
÷
sub times
{ print "A: ", @_ * 2, "\n"; }
sub divide
{ print "B: ", @_ / 2, "\n"; }
print "\n";
times_2();
divide_2();
print "\n";
times_2(2);
divide_2(2);
sub times_2
{ print "C: ", @_ * 2, "\n"; }
sub divide_2
{ print "D: ", @_ / 2, "\n"; }
print "\n";
times_3();
divide_3();
print "\n";
times_3(3);
divide_3(3);
sub times_3
{ print "E: ", "@_" * 2, "\n"; }
sub divide_3
{ print "F: ", "@_" / 2, "\n"; }
.
- Follow-Ups:
- References:
- Trouble running a unix command with a subroutine call
- From: AMT2K5
- Re: Trouble running a unix command with a subroutine call
- From: AMT2K5
- Re: Trouble running a unix command with a subroutine call
- From: Andrew McGregor
- Re: Trouble running a unix command with a subroutine call
- From: Purl Gurl
- Re: Trouble running a unix command with a subroutine call
- From: Mark Clements
- Re: Trouble running a unix command with a subroutine call
- From: Purl Gurl
- Trouble running a unix command with a subroutine call
- Prev by Date: Re: Matching spaces at start of line
- Next by Date: FAQ 7.9 How do I create a module?
- Previous by thread: Re: Trouble running a unix command with a subroutine call
- Next by thread: Re: Trouble running a unix command with a subroutine call
- Index(es):
Relevant Pages
|