David A. Black wrote

> On Sat, 13 Aug 2005, daz wrote:
>
> > David A. Black wrote:
> >
> >> On Sat, 13 Aug 2005, [ISO-8859-1] Brian Schröäer wrote:
> >>
> >>> a minor correction:
> >>>
> >>> On 12/08/05, Julian Leviston wrote:
> >>>> You'd probably want
> >>>
> >>> - puts "Please enter dollar amount":
> >>> + puts "Please enter dollar amount:"
> >>> gets line
> >>
> >> I'm almost certain he actually wants:
> >>
> >>    line = gets
> >
> >
> > raise 'almost certain'  # :-)
> >
> > ------------------------------------------------------------ Kernel#gets
> >     gets(separator=$/)    => string or nil
> > ------------------------------------------------------------------------
> >     Returns (and assigns to $_) the next line from the list of files
> >     in ARGV (or $*), or from standard input if no files are present
> >     on the command line.
> >     [...]
>
> Yes -- hence my original reply:
>
>    I doubt it, unless you've got some reason to expect the input to
>    terminate with whatever line contains :-)
>


I wasn't referring to your 'separator' note.


> > STDIN.gets is safer for this case, I think.
>
> What would be the non-safeness of gets?
>
>
> David
>


Kernel#gets has a higher action when ARGV is non-empty.

 #----------------------
 ARGV.replace ["anyarg"]
 line = gets        # <--- STDIN.gets ---*
 #----------------------

 #-> C:/TEMP/rb80B3.TMP:2:in `gets': No such file or directory - anyarg (Errno::ENOENT)

Quoting the OP:
  "I would like the prompt to display and the user to be able to enter the
   data after the prompt."

No mention of: "... unless he supplies a C/L argument, in which case
treat it as a file and read the input from there instead."

Therefore:
  > > STDIN.gets is safer for this case, I think.


daz