Chas. Owens wrote:
> Rob Dixon wrote:
>>
>> I also think that you have not written
>>
>>  use strict;
>>  use warnings;
>>
>> at the start of your program, and anything that is presented to this list 
>> should
>> at least have those in place.
> 
> Just because I am in a grumpy/contrary mood, I take issue with that
> statement.  Perl is not just a programming language; it is also a
> command line tool.  There is no reason to say
>     perl -Mstrict -wnle 'print $1 if /foo="([^"]*)"' file_of_records
> when
>     perl -nle 'print $1 if /foo="([^"]*)"/' file_of_records
> will do; however, I do agree that any script should definitely use the
> strict and warnings pragmas.  Of course, I haven't seen a
> Perl-as-a-command-line-tool question in a long time, so I am just
> being grumpy.

Contrary is fine Chas, and here is my view.

I think portraying Perl as a command-line tool limits it to fewer platforms than
we would like to see it ported to. In particular the quoting standards for an -e
script vary widely, and I tire of seeing people publish scripts here that will
work only as a Unix shell command line.

I have said several times that the shortcut behaviour of the logical operators
is ugly and unfamilar to non-Unix users (yes, I know C does it, but that is a
deficiency) and I can think of no excuse at all for naming the function 'grep'.
I have also seen far too many questions about 'how can I reduce this algorithm
to a single statement?' Golf aside, there is no reason to reduce any Perl
program to a minimal byte count.

If I had things my way there would never be any use of Perl as a command-line
tool. To use it as one is to clip its wings and invite the prejudice of the many
platforms where that simply will not work. A lot of work has gone into porting
historical behaviour to most conceivable hosts, in particular the fabrication of
a 'fork' call where no such native concept exists. Also -w has been superseded
with 'use warnings', but nothing is so far in place to represent the -n and -p
qualifiers, and they must be considered a legacy.

There is no reason any more to write Perl programs on the command line, and the
sooner we stop trying to force it to be a utility the quicker the world will
adopt it as a language.

Rob

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to