CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

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

 



phatRraptor
Deleted

Aug 16, 2000, 6:18 AM

Post #1 of 3 (3251 views)
Win 98 - Got Book Now Won't Work STDIN Can't Post

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

Post #2 of 3 (3251 views)
Re: Win 98 - Got Book Now Won't Work STDIN [In reply to] Can't Post

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

Post #3 of 3 (3251 views)
Re: Win 98 - Got Book Now Won't Work STDIN [In reply to] Can't Post

He He, yep. Kinda stupid.

Done the same first day of javascript and vbscript !

Thanks.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives