and I gave up the shebang line too

  • Thread starter newyork799-miscperl
  • Start date
N

newyork799-miscperl

all the boilerplate:

#!/usr/bin/perl -w
use strict

is kind of useless in short programs, isn't it ;-)

just use ./perl my_prog.pl

and bang...you get what you want!
 
T

Tintin

all the boilerplate:

#!/usr/bin/perl -w
use strict

is kind of useless in short programs, isn't it ;-)

just use ./perl my_prog.pl

I know I shouldn't feed the troll, but....

Do you seriously like cd'ing the the directory perl lives in to execute a
perl script?
 
J

John Bokma

all the boilerplate:

#!/usr/bin/perl -w
use strict

is kind of useless in short programs, isn't it ;-)

just use ./perl my_prog.pl

and bang...you get what you want!

And one day you will learn that the pl extension can be dropped. Party
time! And if you hack your PATH, you don't even have to type the ./

And a real hacker just does:

perl

and then starts coding :)
 
J

Jürgen Exner

all the boilerplate:

#!/usr/bin/perl -w
use strict

is kind of useless in short programs, isn't it ;-)

Indeed,

use warnings;

is much prefered over "-w"

jue
 
J

James Taylor

use warnings;

is much prefered over "-w"

Really? Why?

Not only is -w shorter to type but it doesn't require perl
to load a module to perform what it can do without one.
I always thought "use warnings;" was for people who found
it difficult to remember -w or who just wanted to be more
in-your-face about turning warnings on and didn't mind the
performance hit of loading another module. What did I miss?
 
P

Paul Lalli

James said:
Really? Why?

Not only is -w shorter to type but it doesn't require perl
to load a module to perform what it can do without one.
I always thought "use warnings;" was for people who found
it difficult to remember -w or who just wanted to be more
in-your-face about turning warnings on and didn't mind the
performance hit of loading another module. What did I miss?

For one, it's nice to have a symmetry between the way you enable
warnings ('use warnings;') and the way you temporarily disable warnings
('no warnings').

For two, -w is global. It enables warnings in every script, everything
that's been require()'d or use'd. If you're using a module which is
for some reason not warnings-compliant, -w will report the warnings in
a module that you have no control over. use warnings; only reports
them in your own script.

Paul Lalli
 
J

James Taylor

For one, it's nice to have a symmetry between the way you enable
warnings ('use warnings;') and the way you temporarily disable
warnings ('no warnings').

Oh, and I thought you just said local $^W = 0;
For two, -w is global. It enables warnings in every script, everything
that's been require()'d or use'd.

Isn't that a good thing?
If you're using a module which is for some reason not
warnings-compliant,

<shock> You mean people still develop code without warnings?! </shock>
<confusion> How do they ensure their code works before releasing it? </confusion>
-w will report the warnings in a module that you have no control over.

Is there such a thing as a module you have no control over?
Surely I could just hack a copy of it and use lib?
use warnings; only reports them in your own script.

That's clever, I wonder how it does that. Just a minute while I
reach in my standard library... It's not there! My version of
perl has no warnings.pm! If I grabbed a copy of warnings.pm from
elsewhere, would it necessarily work on my version of perl:
version 5.005_03 built for arm-riscos?

If you're tempted to tell me to upgrade, I don't have that luxury.
The original porter of perl to RISC OS has lost interest in keeping
it up to date so I'm stuck with 5.005_03.
 
T

Tad McClellan

James Taylor said:
Really? Why?


For the same reason that scoped variables are preferred over global ones.

Not only is -w shorter to type but it doesn't require perl
to load a module to perform what it can do without one.
I always thought "use warnings;" was for people who found
it difficult to remember -w or who just wanted to be more
in-your-face about turning warnings on and didn't mind the
performance hit of loading another module. What did I miss?


Scoping.
 
N

newyork799-miscperl

And one day you will learn that the pl extension can be dropped. Party
time! And if you hack your PATH, you don't even have to type the ./

And a real hacker just does:

perl

and then starts coding :)

whoa, whoa, whoa...I stand in awe ;-) ............!
 
J

Jürgen Exner

John said:
And a real hacker just does:

perl

and then starts coding :)

"Real programmers "cp /dev/audio a.out" and whistle into the mike."
- Randal L. Schwartz, 2002

jue
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top