calling a script with arguments

J

jpw

I have a script that creates and XML record and then posts it to a
url. I'd like to be able to build the XML record separately and just
"pass" it to the script. The script needs to be excuted at the shell
prompt. So, I'd like to be able to execute: ./myscript
<path&filename to xml file>.

How, from within, the script to I get the xml file? In other
programming environments, I have used the @sentence command which
provides the script with the entire line it was executed with.
 
A

anno4000

jpw said:
I have a script that creates and XML record and then posts it to a
url. I'd like to be able to build the XML record separately and just
"pass" it to the script. The script needs to be excuted at the shell
prompt. So, I'd like to be able to execute: ./myscript
<path&filename to xml file>.

How, from within, the script to I get the xml file? In other
programming environments, I have used the @sentence command which
provides the script with the entire line it was executed with.

perldoc perlvar, look for @ARGV.

Anno
 
J

Jürgen Exner

jpw said:
I have a script that creates and XML record and then posts it to a
url. I'd like to be able to build the XML record separately and just
"pass" it to the script. The script needs to be excuted at the shell
prompt. So, I'd like to be able to execute: ./myscript
<path&filename to xml file>.

How, from within, the script to I get the xml file?

perldoc -f open
In other
programming environments, I have used the @sentence command which
provides the script with the entire line it was executed with.

Are you just looking for @ARGV (details see perldoc perlvar)?

jue
 
P

Paul Lalli

I have a script that creates and XML record and then posts it to a
url. I'd like to be able to build the XML record separately and just
"pass" it to the script. The script needs to be excuted at the shell
prompt. So, I'd like to be able to execute: ./myscript
<path&filename to xml file>.

How, from within, the script to I get the xml file? In other
programming environments, I have used the @sentence command which
provides the script with the entire line it was executed with.

Anno and Jue already told you that you're looking for the @ARGV array,
but I am *very* curious what you mean by "the @sentence command".
There is no such command. @sentence is a user-defined array that has
no special meaning whatsoever. Can you please explain what you meant
by this?

Paul Lalli
 
J

jpw

Anno and Jue already told you that you're looking for the @ARGV array,
but I am *very* curious what you mean by "the @sentence command".
There is no such command. @sentence is a user-defined array that has
no special meaning whatsoever. Can you please explain what you meant
by this?

Paul Lalli

Thank you for the replies. While ARGV does provide me the string
value of the command line, as opposed to the actual "content" of the
xml file. Presumably I would then have to *read* the file in to a
variable to then be posted to the url. Incidently, I don't know how
to do that either.

Regarding @sentence. Sorry for the confusion. I should have just
said "commandline arguments". The reference to @sentence was merely
an example from another programing language (namely, Unidata). It's
has the same function as ARGV in PERL.

On to research reading files and assigning them to an array variable
(any knowledge of this?)


John
 
P

Paul Lalli

Thank you for the replies. While ARGV does provide me the string
value of the command line, as opposed to the actual "content" of the
xml file. Presumably I would then have to *read* the file in to a
variable to then be posted to the url. Incidently, I don't know how
to do that either.

Jue gave you that answer too.

perldoc -f open
perldoc -f readline
perldoc perlop

Paul Lalli
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top