How can I prompt the user? 
Author Message
 How can I prompt the user?

Is there a way in perl to prompt the user...
ie. getting info from the stdin.

I tried whit read but I think I'm not using it correctly (I cannot get
out of the prompt unless I do ^C)

Thanks for the hint,

Pascal



Sun, 27 Feb 2000 03:00:00 GMT  
 How can I prompt the user?

: Is there a way in perl to prompt the user...
: ie. getting info from the stdin.
: I tried whit read but I think I'm not using it correctly (I cannot get
: out of the prompt unless I do ^C)

The below is something that I use for getting a password, so I disable
echoing to the screen whilst the user enters the data- you may not need that
requirement in which case delete the calls to the external command 'stty' :-

-- snip --
print "Please enter new password for $group: ";
`stty -echo`;
$pass = <STDIN>;
`stty echo`;
print "\n";
chomp($pass);                                                      
-- snip --

IAP
--
In an attempt to reduce junk email I use an invalid 'From' address.
My correct email address can be determined by replacing 'not.valid' with with
'value.net'



Sun, 27 Feb 2000 03:00:00 GMT  
 How can I prompt the user?

don't exactly know what you want... but to get info from stdin, this is
all you have to do,

$variable = <STDIN>;

of course, the assignment can be more complex than that.  all depends on
what you want.

yin-so  

Quote:

> Is there a way in perl to prompt the user...
> ie. getting info from the stdin.

> I tried whit read but I think I'm not using it correctly (I cannot get
> out of the prompt unless I do ^C)

> Thanks for the hint,

> Pascal



Sun, 27 Feb 2000 03:00:00 GMT  
 How can I prompt the user?

: Is there a way in perl to prompt the user...
: ie. getting info from the stdin.
$info_from_user = <STDIN>;

should work...

Daryl

: I tried whit read but I think I'm not using it correctly (I cannot get
: out of the prompt unless I do ^C)

: Thanks for the hint,

: Pascal

--
<>< Daryl Bowen        <><
Georgia Institute of Technology

Siemens Stromberg-Carlson Co-op



Sun, 27 Feb 2000 03:00:00 GMT  
 How can I prompt the user?

Try this:
...
my $name;
print "Enter Name";
chop($name = <>);
...

Quote:

> Is there a way in perl to prompt the user...
> ie. getting info from the stdin.

> I tried whit read but I think I'm not using it correctly (I cannot get
> out of the prompt unless I do ^C)

> Thanks for the hint,

> Pascal



Sun, 27 Feb 2000 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. How do you prompt a user for data?

2. Is it possible to prompt a user?

3. To Prompt or not To Prompt

4. parsing canned response

5. question about canned perl script

6. Troubles with a Canned script

7. canned reply script

8. canned reply??

9. canned replies

10. Prompting user for USER NAME & PASSWORD via PERL?

11. Real user id and effective user id

12. User to user email

 

 
Powered by phpBB® Forum Software