On Monday, June 10, 2002, at 03:36 , Bryan R Harris wrote:
> > Slightly OT, but does anyone know how to pass an empty string to a script > via the command line? I have a script that is invoked via: > > rename match-str replace-str <list of files> > > .... where the rename script does an s/match-str/replace-str/g on the > filenames (variables evaluated, of course; the script already works). p0: I have not been able to replicate your problem on darwin|linux redhat 7.2|solaris but that doesn't mean it will not happen, so one way to think about working around this would be to do something like use Getopt::Long to help go about defining when you have ended reading the command line arg and are about to read the list of files hence allowing say rename --match-str="...." --replace= ...... p1: the code I tested with is: #!/usr/bin/perl -w use strict; my $matchEx = shift; my $subEx = shift; my $line= "albert was a Happy Person"; print "<$matchEx> undt <$subEx> with @ARGV\n"; $_ = $line; s/$matchEx/$subEx/; print "\$_ now <$_>\n"; and my observed results were: gax: 57:] perl Silly.pl albert '' bob ted carol alice <albert> undt <> with bob ted carol alice $_ now < was a Happy Person> gax: 58:] perl Silly.pl Happy Sad bob ted carol alice <Happy> undt <Sad> with bob ted carol alice $_ now <albert was a Sad Person> gax: 59:] HTH ciao drieux --- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]