F
ff0000
Hi,
I'm in trouble and doubt (is it a Perl or shell (Bash) fault?
while understanding the
@ARGV behaviour... Here's a simple (newbie) script:
--
#!/usr/bin/perl
print "ARGV: `" . "@ARGV" . "`\n";
for my $i (0..$#ARGV) {
print "Argument[${i}]: `" . $ARGV[$i] . "`\n";
}
1;
--
First case:
ff0000@tsi00588pc:tmp$ ./test.pl "a b c"
ARGV: `a b c`
Argument[0]: `a b c`
The "a b c" quoting has been eating up; ok let's protect it:
ff0000@tsi00588pc:tmp$ ./test.pl \"a b c\"
ARGV: `"a b c"`
Argument[0]: `"a`
Argument[1]: `b`
Argument[2]: `c"`
Ouch! The protection has splitted the string... :-/...
Is there a way (without using extra modules) to preserve quoting
through
@ARGV?
Thanks a lot.
ff0000
I'm in trouble and doubt (is it a Perl or shell (Bash) fault?
while understanding the
@ARGV behaviour... Here's a simple (newbie) script:
--
#!/usr/bin/perl
print "ARGV: `" . "@ARGV" . "`\n";
for my $i (0..$#ARGV) {
print "Argument[${i}]: `" . $ARGV[$i] . "`\n";
}
1;
--
First case:
ff0000@tsi00588pc:tmp$ ./test.pl "a b c"
ARGV: `a b c`
Argument[0]: `a b c`
The "a b c" quoting has been eating up; ok let's protect it:
ff0000@tsi00588pc:tmp$ ./test.pl \"a b c\"
ARGV: `"a b c"`
Argument[0]: `"a`
Argument[1]: `b`
Argument[2]: `c"`
Ouch! The protection has splitted the string... :-/...
Is there a way (without using extra modules) to preserve quoting
through
@ARGV?
Thanks a lot.
ff0000