Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: writing to stdin

by cog (Parson)
on Mar 28, 2005 at 14:31 UTC ( [id://442817]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    print "Are you sure? [y]";
    chomp(my $ans = <STDIN>);
    $ans ||= "y";
    ...
    } else {
       # do otherthing
    }
    
  2. or download this
    #!/usr/bin/perl
    print "Are you sure? [y]";
    if (<> =~ /^(y(es)?)?\n$/i) {
    ...
    else {
      # answer was no
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://442817]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-03-28 21:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found