[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] All these new updates to MacPerl...





On Sun, 11 Jan 1998, Chris Nandor wrote:

> At 06.48 98.01.11, Amitava Basu wrote:
> >I tried to run the first script from Learning MacPerl which goes
> >like this.  I compiled the script under MacPerl 5.1or2. This has
> >been drawan from"Learning Perl" by Randal Schwartz and Tom
> >Christiansen.  When I run the script it shows nothing other
> >than the "syntax" ok.  Do I need to have a news version?
> >
> >#!/usr/bin/perl -w
> >print "What is your name?";
> >$naem = <STDIN>;
> >chomp ($naem);
> >if ($name eq "Randal") {
> >print "Hello,Randal!  How good of you to be here!\n";
> >}  else {
> >print "Hello, $name!\n";
> >}
> 
> 
> Well, aside from your problem of $name vs. $name, this works fine under the
> current version of MacPerl (5.1.8r4).  And while older versions of MacPerl
> are largely unsupported, your code above should work fine under older
> versions of MacPerl.  That said, it sounds like instead of running the
> script you are checking its syntax.
> 

If I run this from MPW, having named it Filename and corrected $name, I
get:

perl Filename
What is your name? gjm
Hello, What is your name? gjm!

So STDIN gives the whole line?  Is this standard or do I need to
change my setup?

George


***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch