That's not a Perl (it's Perl, the language, or perl, the binary. It's not spelled PERL) problem. That's a problem to be solved by
the environment you call the Perl program from. If you call
it from a C program, look up the documentation of the
exec* family of functions. If you call it from a
shell, lookup the quoting constructs of your shell (usually,
including the argument in single or double quotes does the
trick). If you call it from another Perl program, lookup
the documentation of system or exec.
If you call it from something else, lookup the documentation
of something else.
Abigail | [reply] |
I'm not sure I understand your question, but you could concatenate them all into one string, like this:
my $arg1 = "204.120.69.195";
my $arg2 = "-";
my $arg3 = "-";
my $arg4 = "GET";
my $single_arg = $arg1 . $arg2 . $arg3 . $arg4;
### $single_arg now equals "204.120.69.195--GET";
my $rc = system("your_perl_script.pl", $single_arg);
and then execute the script passing the new contatenated single argument to the script.
HTH. | [reply] [d/l] |
@echo off
c:\perl\bin\perl.exe myscript.pl "%1%2%3%4%5%6%7%8%9"
The arguments will be concatenated together and available inside the myscript.pl in the $ARGV[0] variable. If you need an example of how to handle more than 9 arguments let me know via /msg since that really isn't a perl question.
Cheers - L~R | [reply] [d/l] [select] |
In Windows NT, you can use %* to represent all parameters. I have not tried this with more than 9, though. I would say that this is close enough to on topic since it is to do with scripting, and many languishing in Windows Land end up wrapping their perl scripts in polyglot batch language.
| [reply] |
Well, that's not really a perl issue, it's to do with the shell you are using. I assume that you are on a *nix platform, running ksh - then you can put the argument inside single quotes, if I remember correctly, certainly worthwhile to give it a try anyway -
perlscript.pl '"204.120.69.195" "-""-" "GET"'
| [reply] [d/l] |
Whether this is even possible, much less how to do it,
depends on which version of DOS you have and
specifically which command interpreter. (What does it
say if you type VER at the prompt?)
Assuming what you have is either really
MS-DOS as such or the "DOS" that's included in Windows
9x/Me (not e.g. the "DOS" included in Windows XP,
which is quite different), your
command interpreter is almost surely command.com,
and you should see the documentation (such as it is)
for that. Depending on your installation, you can
*probably* get help for this using the help command
(i.e., type HELP at the prompt), though I don't recall
how detailed the help for <Command> or whether it
goes into quoting. If not, you might be able to
find an old DOS manual someplace. I have one at home
from ITT DOS that I could consult when I get home.
If you don't find the answer in the next several hours,
/msg me with a reminder to look at that.
I believe that in DOS versions 5 and later and all
versions of Windows 9x/Me what you want to do is
(just barely) possible, but the syntax is a bit weird
and I no longer recall the exact details. (I haven't
done serious BATch programming since I started using
QBASIC circa 1995, and I quit using QBASIC very much
after I got comfortable with elisp circa 2001; these
days I do most stuff in Perl.)
You might be better served to install
an alternative command processor, such as 4DOS (which
is shareware) or bash (which is free from delorie.com
last I checked -- look for DJGPP).
If what you're using is not really DOS (e.g., if you're
really using the "MS-DOS Prompt" in Windows), then
there are additional options available to you, such
as Cygwin; I think there's also a mingw32 port of
bash someplace, which might be easier for you to
integrate into your existing environment.
Another option that is available to you regardless
is to replace the BAT file with a Perl script that
subsumes its functionality. This is probably what
I would do in your shoes. If you post the BAT
file here, I can probably help you translate it
to Perl.
$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}}
split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/
| [reply] [d/l] |
Why not get a Windows port of the bash shell (from Cygwin or Gnu), and use normal shell scripts instead of DOS batch files? A bash shell on Windows even knows how to treat a perl script as an executable program. | [reply] |