From: Chad Perrin Date: 2010-03-01T08:26:29+09:00 Subject: Re: running a file --nmemrqcdn5VTmUEE Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Mar 01, 2010 at 12:57:50AM +0900, John Pasqa wrote: >=20 > thats not how I have it now, but I think it would work beautifully. What= =20 > I need is the code that would let my program take a command argument,=20 > any clues as to where i could find that? Look into Ruby's handling of the ARGV array, which is automaticaly populated with command line argument strings. For instance, if a single argument of 'filename.txt' is supplied, the following is true: ARGV[0] =3D=3D 'filename.txt' Thus, you could use ARGV[0] as an argument for File.open() or File.read() to open a file. There are other means of getting such input in Ruby as well, such as using this: while gets # do stuff with $_ end That can be implicitly wrapped around the rest of your code by way of the -n command line option for Ruby, and is equivalent to the following Perl idiom: while (<>) { # do stuff with $_ } I recommend doing some searches in your favorite search engine for file input and handling of STDIN with Ruby. I've probably done enough of your work for you already. --=20 Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ] --nmemrqcdn5VTmUEE Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAkuK+2MACgkQ9mn/Pj01uKXihACeLS4yVhE32M4crfLNQIMUHkcU +oUAoOwXIHk2FjkONH3ESouFoVm0kHeN =jfsK -----END PGP SIGNATURE----- --nmemrqcdn5VTmUEE--