hi all -
i'm trying to teach myself some perl, and my first project is to take a bash script i wrote to process some logfiles and port it. that script works well, it's just slow, and the whole thing seemed like a good way to learn.
one really nice thing about my bash script is that it looks at any arguments passed, assigns values to variables, and if it finds something's missing, prompts the user for that information before proceeding. i believe i can make the same logic work using perl, but i'm stumped about some specifics. my googling tells me that i probably want to use Getoptions::Long to handle command line arguments; i've gotten fair results using Switch, but i think GetOptions is likely cleaner. i am, of course, open to suggestions.
anyway, since the script will do a few different operations (a basic find, count occurrences of $string, etc.), i'm using $operation to hold, well, the operation we're performing, and $string to hold the string we're looking for. i believe i can use GetOptions to process arguments properly if i call the script like, for example, this:
logChecker --operation find --address me@domain.com
but what i'd really like to do is to call it like this:
logChecker.pl -f me@domain.dom
(so, find (-f) all instances of the supplied email address)
but i can't figure out how to tell GetOptions to assign values to multiple variables based on one pair of options like that. so that's my question: am i asking too much of GetOptions? is it possible for GetOptions to look at something like '-f me@domain.dom' and assign $operation=find AND $string=me@domain.dom?
i'm hoping it's possible, but i haven't found an example of it yet.
thanks in advance,
-john.