Adrian Roskrow wrote:
> Well I have written a small script to read from stdin and guess what, it 
> just sits and does nothing!! I guess I must of got it wrong! Here is 
> small snip-it
>    @number = $stdin.each_with_index do |line, index|
>         printf "%4d %s", index, line
>         end
> 

each_with index reads one line at a time.  A line needs to be
terminated with an end of line character(s) before it can be read.

Does your barcode reader insert end of line characters(s) at the end
of the content of the barcode?

I've used a usb barcode reader (in windows xp) and it does insert
\r\n on the end of each sucessful read.  Try the reader out in
a text editor to see if it does.    If it doesn't, you'll need to
adopt a different approach than reading lines.  Alternatively
in the barcode driver, there may be an option to force it to emit
end of line characters.

If the barcode reader inserts chars into the editor, just like a keyboard,
you shouldn't need to redirect the input at all.  It should
appear on $stdin.

Martin.