Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

I'm an idiot newbie, so

by bsummerer (Initiate)
on Apr 20, 2001 at 22:47 UTC ( #74268=perlquestion: print w/ replies, xml ) Need Help??
bsummerer has asked for the wisdom of the Perl Monks concerning the following question:

I looked on the site search and tutorial on how to do this, but searching for "command line" gives me perl execution options...

Anywho, I put together a script that pings an URL then if it's dead, it logs the error and runs a netstart/netstop from the command line. Haven't figured that part out yet. If I'm running the script at, say c:\ and I want to run a file called "something" with the arguements "this and that", how would I do that (essentially what is the perl equivalent of "execvp(argv[0],argv)" in c++?)

Edited 2001-04-20 by Ovid

Comment on I'm an idiot newbie, so
Download Code
Re: I'm an idiot newbie, so
by Chady (Priest) on Apr 20, 2001 at 22:53 UTC
    are you searching for exec ??
    He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.
      Didn't know if that was even a keyword. Many thanks. -Brett

        Beware that exec never returns (if you didn't already know that), because it replaces your process with the new one.

        If you want to make multiple "execs", you can use system.

        Check out perlfunc for a list of all available functions and keywords in Perl.

        bbfu
        Seasons don't fear The Reaper.
        Nor do the wind, the sun, and the rain.
        We can be like they are.

        Just to complete chady and bbfu answers.
        backticks quotes could be handy too...
        (When you need to grab the produced output)

        You might then use something like :
        $string_to_process=`ping $host`;
        (notes that variable are interpolated inside backticks)

        "Only Bad Coders Badly Code In Perl" (OBC2IP)
Re: I'm an idiot newbie, so
by Tuna (Friar) on Apr 21, 2001 at 02:08 UTC
    Kinda off topic, but, there's no need to be self-deprecating :) Every person here wrote code for the first time, or was a "newbie", once.
Re: I'm an idiot newbie, so
by Beatnik (Parson) on Apr 21, 2001 at 02:46 UTC
    Try @ARGV... the first parameter is $ARGV[0], second is $ARGV[1] etc. You also might wanna look at Getopt::Long and Getopt::Std. More info, check here

    Greetz
    Beatnik
    ... Quidquid perl dictum sit, altum viditur.
Re: I'm an idiot newbie, so
by diskcrash (Hermit) on Apr 21, 2001 at 21:33 UTC
    Dear bsummerer-

    A good question and I know you WAY too well to agree that you are an "idiot newbie". Let us know how it worked out.

    -diskcrash

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://74268]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2014-07-12 00:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (237 votes), past polls