absolutezero1287

November 5th, 2009, 07:36 AM

So how do I do it?

I wrote a script that has many subroutines for doing various mathematical operations (solve quadratics, find the sum of all numbers in a finite series, midpoint between two lines, and others). I named the script math.pl but what I'd like it to do is print a usage message if no argument is passed, e.g. USAGE -g run the gauss subroutine, etc. etc. I figured that I could do something like:

if (@ARGV = "") {

print "USAGE:\n-g run the gauss subroutine\n";

}

However this doesn't look right.

I wrote a script that has many subroutines for doing various mathematical operations (solve quadratics, find the sum of all numbers in a finite series, midpoint between two lines, and others). I named the script math.pl but what I'd like it to do is print a usage message if no argument is passed, e.g. USAGE -g run the gauss subroutine, etc. etc. I figured that I could do something like:

if (@ARGV = "") {

print "USAGE:\n-g run the gauss subroutine\n";

}

However this doesn't look right.