On 4/13/05, Bret Goodfellow <[EMAIL PROTECTED]> wrote: > I have a script that is reading input from ARGV. The script is being > passed a file name as follows: > > datefile.pl c:\program files\IBM\SQLLIB\DB2\db2diag.log > > The problem I am running into is that the space is not recognized in the > argument. All that I get passed to is is c:\program . How do I get > the rest of the argument. Below is a portion of the script. Thanks. > > #*********************************************** > # check input parameter * > #*********************************************** > $arg_length = length($ARGV[0]); > $arg_lastchar = substr($ARGV[0], $arg_length-1, 1); > $arg_string = $ARGV[0] ; > print "Parameter argument is: $arg_string \n"; > >
This is really an OS question, not a perl question: you'd have this problem with any language, including, I think the built-in windows shell interpreter--but that's another issue. Most OSes and/or shells have some method of escaping characters. in most unix environments, you'd handle this by using single quotes on the command line: datefile.pl '/path/to/file'. I'm not sure how windows handles it (Ithink double and singe quotes may have the opposite meanings), and it might vary between 95 and NT/2000/XP. Try both of the following, one of them will work: datefile.pl 'c:\program files\IBM\SQLLIB\DB2\db2diag.log' datefile.pl "c:\program files\IBM\SQLLIB\DB2\db2diag.log" If you're going to be be doing a lot of work on Windows, take a look at perldoc perlport, and pick up a copy of _Learning Perl for Win32_ HTH, --jay -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>