On Mon, May 21, 2001 at 03:57:00PM +0100, ruby-talk / ruby-lang.org wrote: > Renald Buter <buter / CWTS.LeidenUniv.nl> writes: > > > is there a standard 'stdin' and/or 'stdout' "name", e.g. the '-' in perl? I > > see a reference to something like it when using "Kernel.open('|-')" --- but > > this seems to be the only/special case? > > You can use STDIN, STDERR, and STDOUT as file objects connected to the > respective underlying streams. > > You can also read from ARGF, which is the concatenated input stream > formed by all the files specified on the program's command line, or > stdin if none were specified. Thus > > ARGF.each do |line| > end > > is roughly equivalent to Perl's > > while (<>) { > $line = $_; > } > > Hmmm... I think I was a bit unclear in my request. What I meant was; are there strings object that map directly onto $stdin or $stdout when used in File.open(string), e.g.: f = File.open('-') # f is $stdin g = File.open('>-') # g is $stdout h = File.open('-',"w") # h is $stdout This would allow me to have simple default names in methods that are also HUMAN READABLE: def open_file(infile='-',outfile='>-') puts "Reading from #{infile} to #{outfile}" # ^^^ this would not output things like <IO:blabla> but # proper names # ... use infile, outfile ... end Or am I thinking to perlish here, and is there a better way to map the STD* objects from AND onto string objects? Renald