command line commands passed to perl script?

Hi all,

Sorry, should have added this to my last email. Does
anyone know how to pass values to a perl script
through the command line? Do you use param as in CGI
scripting/

I want a user to be able to specify certain parameters
for the perl script (in case they want to run an
overnight scheduler on it).

Eg. testscript.pl /? gives you help or testscript /a
gives you another capability...

Ben

__________________________________
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing.
http://photos.yahoo.com/
0
crane_ba
12/9/2003 4:22:46 PM
perl.beginners 29388 articles. 4 followers. Follow

5 Replies
707 Views

Similar Articles

[PageSpeed] 41
Get it on Google Play
Get it on Apple App Store

Nameofperlscript command1 command2 command3

Params stored in global variable @ARGV



> -----Original Message-----
> From: Ben Crane [mailto:crane_ba@yahoo.com] 
> Sent: Tuesday, December 09, 2003 11:23 AM
> To: beginners@perl.org
> Subject: command line commands passed to perl script?
> 
> 
> Hi all,
> 
> Sorry, should have added this to my last email. Does
> anyone know how to pass values to a perl script
> through the command line? Do you use param as in CGI
> scripting/
> 
> I want a user to be able to specify certain parameters
> for the perl script (in case they want to run an
> overnight scheduler on it).
> 
> Eg. testscript.pl /? gives you help or testscript /a
> gives you another capability...
> 
> Ben
> 
> __________________________________
> Do you Yahoo!?
> New Yahoo! Photos - easier uploading and sharing. 
http://photos.yahoo.com/

-- 
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>


0
pkraus
12/9/2003 4:38:32 PM
You should use this: testscript.pl  blah

where blah is the value to pass.



Ben Crane wrote:

>Hi all,
>
>Sorry, should have added this to my last email. Does
>anyone know how to pass values to a perl script
>through the command line? Do you use param as in CGI
>scripting/
>
>I want a user to be able to specify certain parameters
>for the perl script (in case they want to run an
>overnight scheduler on it).
>
>Eg. testscript.pl /? gives you help or testscript /a
>gives you another capability...
>
>Ben
>
>__________________________________
>Do you Yahoo!?
>New Yahoo! Photos - easier uploading and sharing.
>http://photos.yahoo.com/
>
>  
>


0
mygrps
12/9/2003 5:15:23 PM
On Dec 9, 2003, at 8:38 AM, Paul Kraus wrote:
[..]
> Nameofperlscript command1 command2 command3
>
> Params stored in global variable @ARGV


ben,

the alternative of course is to look into

	perldoc Getopt::Long

where you can do many majical voodoo with...

Oh dear, just found my old DOG about getopt
<http://www.wetware.com/drieux/pbl/Sys/NextStuff/getOptStd.txt>

oye is that old... and yes it was built to have
code start code that does the GetOpt stuff...


ciao
drieux

---

0
drieux
12/9/2003 6:01:22 PM
Ben Crane wrote:
> 
> Hi all,

Hello,

> Sorry, should have added this to my last email. Does
> anyone know how to pass values to a perl script
> through the command line? Do you use param as in CGI
> scripting/
> 
> I want a user to be able to specify certain parameters
> for the perl script (in case they want to run an
> overnight scheduler on it).
> 
> Eg. testscript.pl /? gives you help or testscript /a
> gives you another capability...

If you want to use the DOS command line switch (/) you could write your
own parser for the @ARGV array however Perl provides the Getopt::Std and
Getopt::Long modules which use the more standard '-' and '--' for
processing command line switches.

perldoc Getopt::Std
perldoc Getopt::Long



John
-- 
use Perl;
program
fulfillment
0
krahnj
12/9/2003 10:11:16 PM
=20
IMHO, parsing command-line options sounds a lot easier than it is.
Definitely use the modules unless you have a good reason for not doing
so.  The author(s) of the module have probably already dealt with the
forehead-slappers that might not be obvious right off the bat, and it
will save you a lot of time down the road.  Save your brainpower for the
more important parts of your program rather than reinventing this
particular wheel.  Again, it's just my opinion...
0
tjohnson
12/9/2003 10:18:56 PM
Reply:

Similar Artilces:

How to pass command line arguments to an extension using a command line on MacOS
I am developing an extension that processes some command line options. I want to invoke the Firefox from a command line like this: > ...../firefox -myarg1 -myarg2 I am running into a problem on Mac OS. When I run such command when there is no FireFox running it works fine. However if I run the command again I get an error saying that there is already an instance of Firefox running and only one instance can run at a time (paraphrasing here). I have tried to use the -remote option but no luck. Does anyone know how to solve this problem? Does anyone know if invoking of chatzill...

How to pass command line arguments to an extension using a command line on MacOS?
I am developing an extension that processes some command line options. I want to invoke the Firefox from a command line like this: > ...../firefox -myarg1 -myarg2 I am running into a problem on Mac OS. When I run such command when there is no FireFox running it works fine. However if I run the command again I get an error saying that there is already an instance of Firefox running and only one instance can run at a time (paraphrasing here). I have tried to use the -remote option but no luck. Does anyone know how to solve this problem? Does anyone know if invoking of chatzill...

Command line commands
Within a PowerBuilder application, how do I create an association so that all files with no extension are opened with notepad? I am using InsertFile command. I know we can use the command line 'assoc' command but I don't know how to include it in PowerBuilder code. I am using PowerBuilder 6.5 Thanks Mangala You could probably do that with the run function. However, you should be careful because most directories don't have extensions. I don't know what kind of behavior that will cause. Mike ...

Command Line commands
Is there a list of commands that can be used at the NetWare server and at the Windows workstation command line for ZFD 4.? I can't find them in the documentation or on the knowledgebase apart from ZENVER. Thanks in advance for any replies. Spamaddress@spam.com, > Is there a list of commands that can be used at the NetWare server and at > the Windows workstation command line for ZFD 4.? > To control what? NAL? - Anders Gustafsson, Engineer, CNE6, ASE NSC Volunteer Sysop Pedago, The Aaland Islands (N60 E20) Novell does not monitor these forums officiall...

[PATCH] dprofpp
I've been frustrated at times that I can't do this: dprofpp -p 'foo.pl -v 1 -d 4 -flubber -haha' and have it work right. The simple patch (against dprofpp.PL in bleedperl) below my sig makes that work. Given that dprofpp can be used in a lot of ways, I'm not sure what harm it might do... There are a lot of cases in which it WON'T work, but for simple command-line args it does. And that's what I'm after--something which handles more cases than what it does today. Thoughts? Flames? Jeremy -- Jeremy D. Zawodny | Perl, Web, MySQL, Li...

KDE4 icons and command line commands
I'm running Suse 11.3 with KDE4. I have an icon in my Kickoff Application Launcher for xterm. When I click on the icon, it apparently executes the command /usr/bin/xterm which generates a large window with a large font. I would like to get a smaller window with a smaller font. I know how to do that on a command line but to execute the command I need to _already_ have a window open so I can run the command. So how do I (a) add a new icon to the KDE launcher which generates the command I want or (b) change the existing icon so that it executes MY command and not the basic...

Cool command line prompt command
Last night I rebooted a web server, and after doing so, I couldn't RDP into it. So, in the meanwhile, while I awaited a response from those in power who could go to the data center and physically restart the server, I thought there must be a command line prompt command that I can run from one of the other servers to reboot it. I found a command called shutdown. I ran shutdown /r /f ComputerName and it rebooted the server and then I was able to access it via RDP. shutdown /r /f ComputerName /r - Restart/f - Forced restartRyan OlshanASPInsider | Microsoft MVP, ASP.NEThttp://ryanolshan.c...

TFS Command Line Get Command
Hi Can you pls help me how to pull the latest version or label from the TFS through Command Line. I went through the msdn documentation. I am not able to get a clear picture. I am expecting some command with example where I can pass the server name, Credentials and sourcepath and Destination path. Basically I want to pull the get latest to a local path which  will be specified in the command line utility. Hope so I am clear.  Pls help me.RegardsFinny  You can use tf command line utilityThis utility can be found in C:/ProgramFiles/Microsoft Visual Studio (9 or 8...

Command line scripting
This question is about normal ASP, not ASP.Net. My question is can make ASP script to run it without any browser accessing the page (Command line scripting). I need this because I want to run ASP scripts regularly executed without any user requesting the page. Thanks for your time. you don't want ASP. you want WSH get the windows scripting docs : http://msdn.microsoft.com/scripting/ will append to this post when I get to work - got to rush now. jRTFM - straight talk for web developers. Unmoderated, uncensored, occasionally unreadableJason Brown - MVP, IIS OK, back at th...

command line scripts
Does anyone know how I can run command line scripts using asp.net and vb? I am mostly interested in using the iis command line script iisweb.vbs to create and delete websites. I would like to have a form that, when submited, runs the the command line script using the form values. Thanks Look at the Process class in the System.Diagnostics namespace. You can also use the class to redirect output into a stream for reading from your application. You might need to twiddle with security settings in order to have the permissions to do this from an ASP.NET app, impersonation is one option. Feel...

How to pass 2 command arguments for a single command?
Hi I need 2 command arguments for edit . I tried to Pass like CommandArgument='<%# Eval("Path") +'|'+Eval("imageTypeId") this and in the .csstring arg = Convert.ToString(e.CommandArgument); Response.Write(arg);string[] splitarg = arg.Split('|'); Response.Write(splitarg[0]); Its not working. can anyone help me?  I'm using XmlDatasource try this CommandArgument='<%# XPath("Name").ToString() + "|" + XPath("Name").ToString()%>' Hosam Kamel Remember to click on Mark as answer on the p...

What are command line commands to detach and attach a db
What are the command line commands to detach and attach a database? My copy of Microsoft SQL Server Management Studio Express has stopped working. So I need to detach the database using the commands.Thank youJackxxx Is this what you are looking for: http://support.microsoft.com/kb/224071Thanks,MaxLet Me Google That For You! sp_attach_db sp_detach_dbBeware of bugs in the above code; I have only proved it correct, not tried it. (Donald Knuth)...

Command line "move" command?
I have a question about possibly setting up a Cron job to move files. First some background. Netware 6.0, Groupwise 6.5. We are using Gwavasig to append a signature to our email messages. Some of our email messages seem to get stuck in the Gwavasig "send" directory, particularly when we send out large numbers of messages (like our monthly client mailout) . However, if we move these files from "send" to "receive" they all go out with no problem. I would like to automate this so that any remaining messages are moved automatically once or twice a day. S...

Thinking in commands, developer tools command line
Joe Walker has been building a great "modern command line" for developer tools. You can see it right now in Nightly by setting devtools.gcli.enable to true in about:config. When you do so, you'll see the Web Console's JavaScript command line change to a tool-oriented command line (which means: designed to be very quick to type). You can still run JavaScript by hitting { (curly brace) This has the potential to be an amazing feature... but it needs commands. I started a wiki page: https://wiki.mozilla.org/DevTools/ThinkingInCommands I'm interested in hearin...

AFPBIND script command line
Forgot to enable AFP when creating cluster enable volumes with Console 1 Adding the AFPBIND and AFPUNBIND commands in load and unload script will be enough ? (NFAP for Mac already installed). Thanks Mirliton I can't say definitively for NW6, but this worked for me with NW6.5. On Tue, 11 Nov 2003 14:46:22 GMT, mirliton@myrealbox.com wrote: >Forgot to enable AFP when creating cluster enable volumes with Console 1 >Adding the AFPBIND and AFPUNBIND commands in load and unload script will >be enough ? (NFAP for Mac already installed). >Thanks >Mirl...

Web resources about - command line commands passed to perl script? - perl.beginners

Command - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Cameron Carpenter review: Bells and whistles matched by a command of the organ
It's certainly no exaggeration to call Cameron Carpenter's command of six keyboards (five for hands, one for feet) "genius". Purely in cognitive ...

Gino and Mark Stocco: Police move command post to Wangaratta in search for fugitives
Police in Victoria move their command post to Wangaratta as they continue the hunt for father and son fugitives Gino and Mark Stocco.

Command your club to victory in Sega's Football Manager Mobile 2016
The 2016 edition of Football Manager Mobile (formerly known as Football Manager Handheld) has kicked its way to iOS.

How to craft your own custom voice commands for Amazon Echo's Alexa
With a little help from IFTTT, you can teach Alexa all sorts of new tricks. Here's how to get started.


Amazon Echo owners can create custom voice commands with IFTT
... item to your shopping list is pretty cool, but there comes a point where you start to feel the limits of the Echo's pre-programmed voice commands. ...

Distraction Dangers Of Voice Command Systems Build Case For Autonomous Vehicles
It turns out that even if your eyes are on the road and your hands are on the wheel, voice command systems in cars are just as mentally distracting ...

Huckabee: Don't Settle for Minimum Wage, Work to Command a Maximum Wage
In his opening remarks last night, Mike Huckabee said proposals to raise the minimum wage in several states will not bring prosperity and independence ...

Carly Fiorina Calls for 'Consolidated Command' to Protect Against Solar Storms
Carly Fiorina said she would create a "consolidated command" to deal with the threat of major solar storms.

Resources last updated: 11/23/2015 3:26:18 AM