Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Question from perl newbie

0 views
Skip to first unread message

Jürgen Exner

unread,
Dec 18, 2006, 10:05:03 AM12/18/06
to
[X-Post and follow-up to CLPM because CLP has been a zombie for many years,
please see the FAQ]

Victor wrote:
> I downloaded and installed Perl, seemingly in a successful manner to a
> Windows XP computer. then I wrote the following code to a file,
> Example_4_1.pl:
>
> #! ..\bin\perl -w

Windows doesn't care about the shebang line. You can just as well leave it
out.
The command line option -w is outdated. It is better to use
use warnings;
instead.

> $DNA = 'abc' ;
> print $DNA ;
> exit ;

If exit is the last statement and you are not returning any special value
then you may just as well omit it.

> Then, I run:
>
>> perl Example_4_1.pl

Normally your Perl installation should have associated the .pl extension
with the Perl interpreter, such that you can run any Perl program by just
typing its name without calling the interpreter directly.

Example_4_1.pl

> The program seems to run without complaints, yet I don't see the
> output of the print statement. What do I need to do to be able to
> see the output?

That is weird. There is nothing wrong with your Perl code.
Maybe someone in CLPM knowns.

jue


Josef Moellers

unread,
Dec 18, 2006, 10:16:39 AM12/18/06
to

I'm not a Windows person (quite to the contrary ;-), but there's no line
terminator, so maybe the prompt overwrites the output (just 3 letters)?

Try
print $DNA, "\n";

Josef

--
Josef Möllers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize
-- T. Pratchett

Dr.Ruud

unread,
Dec 18, 2006, 10:53:20 AM12/18/06
to
Jürgen Exner schreef:

> Windows doesn't care about the shebang line.

AFAIK, it does obey the options, like -l and -w.

--
Affijn, Ruud

"Gewoon is een tijger."

Robert Hicks

unread,
Dec 18, 2006, 11:22:09 AM12/18/06
to

Probably a better answer would have been "It's optional on Windows".

Robert

Dr.Ruud

unread,
Dec 18, 2006, 6:56:29 PM12/18/06
to
Robert Hicks schreef:
> Dr.Ruud:
>> Jürgen Exner:

>>> Windows doesn't care about the shebang line.
>>
>> AFAIK, it does obey the options, like -l and -w.
>

> Probably a better answer would have been "It's optional on Windows".

My "it" was "Windows' perl".

Randolf Richardson

unread,
Jan 17, 2007, 6:02:31 PM1/17/07
to
On Mon, 18 Dec 2006 07:05:03 -0800, Jürgen Exner <jurg...@hotmail.com>
wrote:

> [X-Post and follow-up to CLPM because CLP has been a zombie for many
> years,
> please see the FAQ]
>
> Victor wrote:
>> I downloaded and installed Perl, seemingly in a successful manner to a
>> Windows XP computer. then I wrote the following code to a file,
>> Example_4_1.pl:
>>
>> #! ..\bin\perl -w
>
> Windows doesn't care about the shebang line. You can just as well leave
> it out.
> The command line option -w is outdated. It is better to use
> use warnings;
> instead.

[sNip]

The "strict" module is also recommended:

use strict;

--
Randolf Richardson - kingpi...@lumbercartel.ca
The Lumber Cartel, local 42 (Canadian branch)
http://www.lumbercartel.ca/

0 new messages