From owner-freebsd-questions@FreeBSD.ORG Thu Aug 4 07:58:17 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BC07C16A420 for ; Thu, 4 Aug 2005 07:58:17 +0000 (GMT) (envelope-from daniel@stiw.org) Received: from smtp.conceptual.net.au (grimiore.conceptual.net.au [203.190.192.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id E99A543D48 for ; Thu, 4 Aug 2005 07:58:16 +0000 (GMT) (envelope-from daniel@stiw.org) Received: from spock.enterprise.prvt (202-137-107-088.adsl.usertools.net [202.137.107.88]) by smtp.conceptual.net.au (Postfix) with ESMTP id 3C51113958; Thu, 4 Aug 2005 15:58:14 +0800 (WST) Date: Thu, 04 Aug 2005 15:58:13 +0800 From: "Daniel Marsh" To: "Michael Beattie" , "Wouter van Rooij" References: <7603e5d805080317593a046eec@mail.gmail.com> <7603e5d8050803181766be524b@mail.gmail.com> Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-15 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID: In-Reply-To: User-Agent: Opera M2/8.02 (Win32, build 7680) Cc: freebsd-questions@freebsd.org Subject: Re: perl X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2005 07:58:18 -0000 On Thu, 04 Aug 2005 09:38:15 +0800, Michael Beattie wrote: > On 8/3/05, Wouter van Rooij wrote: >> \ >> >> Hello, >> >> At the first place, sorry for my bad English. >> My question is: >> How can you, when you're writing a perl program, make a input >> () hidden, so that when someone is typing an input in the >> following program is hidden: >> #!/usr/bin/perl >> print "Your name:"; >> $name = >> I would like to get the input like this: ******** >> The PERL Cookbook seems to have the answer. Problem You want to read input from the keyboard without the keystrokes being echoed on the screen. For instance, you want to read passwords as passwd does, i.e. without displaying the user's password. Solution Use the CPAN module Term::ReadKey, set the input mode to noecho, and then use ReadLine: use Term::ReadKey; ReadMode('noecho'); $password = ReadLine(0);