Home: Perl Programming Help: Win32 Programming Help:
Win 98 - Got Book Now Won't Work STDIN



phatRraptor
Deleted

Aug 16, 2000, 6:18 AM


Views: 6626
Win 98 - Got Book Now Won't Work STDIN

Hi all, I've installed perl on win 98 and well I've bought the books and I
can't even get past the first bit of code.

The code is :
#! /usr/bin/perl -w
print "Whats Your Name ?";
$name = <STDIN>;
chomp (&name);
print ("Hello, &name!\n");

I've opened up a dos prompt and entered:
C:\Perl\bin>perl C:\test.pl

And this is what i got:
Whats Your Name ?

I entered Mic and got:
Can't modify non-lvalue subroutine call at C:\test.pl line 4, <STDIN> line
1.

Any Ideas ?


rGeoffrey
User

Aug 16, 2000, 9:00 AM


Views: 6626
Re: Win 98 - Got Book Now Won't Work STDIN

I think you wanted to line 4 to be...

chomp ($name);

You just got the string $name from the user and then you are asked to chomp the return value of a function &name.



phatRraptor
Deleted

Aug 16, 2000, 9:37 AM


Views: 6626
Re: Win 98 - Got Book Now Won't Work STDIN

He He, yep. Kinda stupid.

Done the same first day of javascript and vbscript !

Thanks.