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.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>