in reply to writing to stdin
Well.. try something like:
print "Are you sure? [y]"; chomp(my $ans = <STDIN>); $ans ||= "y"; if ($ans =~ m!^y(es)?!) { # do something } else { # do otherthing }
Update: added missing chomp thanks to cog. Added some more code as asked by virtualsue.
Alberto Simões
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: writing to stdin
by cog (Parson) on Mar 28, 2005 at 14:31 UTC | |
Re^2: writing to stdin
by cog (Parson) on Mar 28, 2005 at 13:18 UTC | |
Re^2: writing to stdin
by virtualsue (Vicar) on Mar 28, 2005 at 13:25 UTC |
In Section
Seekers of Perl Wisdom