I would change

if $indent > 0
  (1..$indent).each { print ' ' }
end

to

print ' ' * $indent

On Dec 3, 2007 10:57 AM, Johnathan Smith <stu_09 / hotmail.com> wrote:
> hello,
>
> im new to ruby and i have a text file and want to read in the file
> and print it out.
>
> so far iv got the following. I'd greatly appreciate any help.
>
> thanks.
>
> text file (reference.txt):
> Tag: ref1
> Type: Book
> Author: Little, S R
>
> ruby file:
> #!/usr/local/bin/ruby
> #
> #
> # read file and print
> #
>   ARGV.each do |fn|
>     begin
>       (fn == '-' ? STDIN :  File.open(fn)).each_line do |l|
>   if $indent > 0
>     (1..$indent).each { print ' ' }
>         end
>   puts l
>       end
> --
> Posted via http://www.ruby-forum.com/.
>
>