calling an invocation argument from @ARGV
From: Christopher Spears (cspears2002_at_yahoo.com)
Date: 02/25/05
- Next message: Errin M HMMA/IT Larsen: "RE: calling an invocation argument from @ARGV"
- Previous message: mgoland_at_optonline.net: "Re: redefining Net::Telnet "escape" character"
- Next in thread: Errin M HMMA/IT Larsen: "RE: calling an invocation argument from @ARGV"
- Maybe reply: Errin M HMMA/IT Larsen: "RE: calling an invocation argument from @ARGV"
- Maybe reply: Errin M HMMA/IT Larsen: "RE: calling an invocation argument from @ARGV"
- Reply: John W. Krahn: "Re: calling an invocation argument from @ARGV"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
- Next message: Errin M HMMA/IT Larsen: "RE: calling an invocation argument from @ARGV"
- Previous message: mgoland_at_optonline.net: "Re: redefining Net::Telnet "escape" character"
- Next in thread: Errin M HMMA/IT Larsen: "RE: calling an invocation argument from @ARGV"
- Maybe reply: Errin M HMMA/IT Larsen: "RE: calling an invocation argument from @ARGV"
- Maybe reply: Errin M HMMA/IT Larsen: "RE: calling an invocation argument from @ARGV"
- Reply: John W. Krahn: "Re: calling an invocation argument from @ARGV"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|