Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading <STDIN> w/out eching to screen

Status
Not open for further replies.

charlesy

Programmer
Aug 3, 1999
26
0
0
AU
I need to read a line of input from &lt;STDIN&gt;<br>without outputting to screen. ie<br>like a su command.<br>
 
try<br><FONT FACE=monospace><b><br>system('stty -echo');<br>$response = &lt;STDIN&gt;;<br>system('stty echo');<br>print $response;<br></font></b><br>presuming you're on a unix system....<br> <p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>
 
This is an easy problem to fix. Try this, if you are on a Win32 system.<br><br><FONT FACE=monospace><br>print &quot;enter some information\n&quot;;<br>$info = &lt;STDIN&gt;;<br>chomp($info);<br><br></font> <br><br>That should do it. Say you enter &quot;some information&quot; into the program, then the variable $info will have the value &quot;some information&quot; and you can decide what to do with it.<br><br>
 
Vikter,<br><br>&nbsp;&nbsp;&nbsp;does that stop the &quot;some information&quot; from being echoed on the command line as you type it though? Which I think was charlsey's aim.<br><br>&nbsp;&nbsp;&nbsp;Is there a way of doing this on windows?<br><br>Loon
 
Sorry - I'm a Unix chap myself... <p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>
 
Me too! Shame window doesn't use tty's :)<br><br>Loon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top