I think the following is an example of what you want:
<snip>
#!/usr/bin/perl
use strict;
use Getopt::Long;
my $search;
GetOptions('search=s' => \$search);
if ($search eq 'log') {
print "Search Keywords: @ARGV\n";
} else {
print "You are not searching the log!\n";
}
</snip>
--
Justin Jereza
LPIC-1
On Thu, Mar 10, 2011 at 3:00 PM, Ludwig Isaac Lim <[email protected]> wrote:
> Hi:
>
>
> I want to implement the following below, is it possible using
> Getopt::Long?
> search.pl where=<value> <search value>
>
> where <search value> must be supplied if the parameter where=<value>
> preceed it.
>
> Example : search.pl where=log "error" # locate for
> word "error" on the log
> search.pl where=data "name" # locate for
> word "name" on the data file
>
> I know I can implement it is implemented the following way below:
> search.pl where=<value> keyword=<value>
>
> But is it possible to implement something like the one I described
> above? (search.pl where=<value> <search value>), I'm just thinking
> keyword=<value> is a bit too "verbose" :-)
>
> I read through the docs but could not find satisfactory answer.
>
> Thanks in advance.
>
> Regards,
> Ludwig
>
>
>
>
> _________________________________________________
> Philippine Linux Users' Group (PLUG) Mailing List
> http://lists.linux.org.ph/mailman/listinfo/plug
> Searchable Archives: http://archives.free.net.ph
>
_________________________________________________
Philippine Linux Users' Group (PLUG) Mailing List
http://lists.linux.org.ph/mailman/listinfo/plug
Searchable Archives: http://archives.free.net.ph