calling an invocation argument from @ARGV

From: Christopher Spears (cspears2002_at_yahoo.com)
Date: 02/25/05


Date: Fri, 25 Feb 2005 09:39:05 -0800 (PST)
To: beginners@perl.org

I'm trying to automate g++ through a Perl script.
Here is what I have written so far:

#!/bin/perl -w
use strict;

my $counter;
$counter = 0;

for (my $i = 0; $i < @ARGV; $i++) {
    $counter++;
}

if ($counter == 0) {
    print "Not enough arguments!";
    print "Usage: ./cedit somefile.C++";
    print "Usage (optional): ./cedit somefile.C++
outputfile";
} elsif ($counter == 1) {
    system "g++", (first invocation argument);

How do I call individual arguments from the @ARGV
array? Basically, the usage of the script (called
cedit) is:

$./cedit somefile.C++

or

$./cedit somefile.C++ outputfile

The first argument is the .C++ file to be compiled,
and the second argument is the name of the .exe file.



Relevant Pages

  • how to call a file
    ... I have written a perl script which is of .pl extension ... Now i want to create an .exe file from it. ... i want to call that perl script and execute it in VB to get a .exe ... Prev by Date: ...
    (microsoft.public.vb.general.discussion)
  • Re: How to use PAR module pp command
    ... to convert my perl script in to a .exe file? ... Can you explain how the multitude of examples in the documentation for ...
    (comp.lang.perl.misc)
  • Re: how to call a file
    ... compile it using VB so it is self executable without perl.exe? ... with perl.exe and extracting each program when your .exe is run. ... > I have written a perl script which is of .pl extension ... > Now i want to create an .exe file from it. ...
    (microsoft.public.vb.general.discussion)
  • SC Create Service
    ... I want to run a perl script, but the exe file is on directory, and the ... Regards, ... Prev by Date: ...
    (microsoft.public.windows.server.general)