On Apr 9, Michael Gargiullo said:

>While asking a few questions to run a script.  How can I give a default
>answer?
>
>print "File to use:";
>chomp(my $question = <STDIN>);

Most programs do it like so:

  my $default = "/foo/bar/blat";

  print "File to use? [$default] ";
  chomp(my $question = <STDIN>);
  $question = $default if $question eq '';


_________

Ok cool... as I waited for an answer, that's pretty much what I did.  I was
wondering if there was a more elegant solution.  This works just fine
though.

Thanks everyone.

-Mike


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to