Interesting! It looks like my problem comes from the way I'm reading arguments off the command line. I've been using:
$match = shift || die("Usage: rename match-expr replace-expr [filenames] \n example: rename txt html *.txt\n"); $replace = shift || die("Usage: rename match-expr replace-expr [filenames]\n example: rename txt html *.txt\n"); Apparently the shift pulls off the empty string just fine (passed using two single quotes ''), but it doesn't return a 1 for the empty string, so the script "dies". I'm a little vague on the fix, is it immediately clear to someone? - B __________________ > -----Original Message----- > From: Anders Holm [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, June 11, 2002 8:46 AM > To: Ramprasad A Padmanabhan; [EMAIL PROTECTED] > Subject: RE: passing an empty string to a perl script via command line > > > And, for completeness: > > I'd think that it's not *nix that ignores the "", but rather > Perl says that > the variable that you assign the value to would then be > undefined and just > refuses to work with it. > > - use strict; should give you a warning about that. FWIW, "use strict" is a compile-time pragma and has nothing to do with the contents of any variable. It does not issue warnings; it raises compile-time errors. Given the command: $ perl myprog.pl foo '' bar $ARGV[0] will be 'foo' $ARGV[1] will be '' (zero-length string, NOT undef) $ARGV[2] will be 'bar' If you're using Windoze, you need to use double-quotes: C:\> perl myprog.pl foo "" bar The parsing of the command line and preparation of the argument list is a function of the shell or command interpreter. Perl just takes the argument list given to it via the execve() call. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]