List Info

Thread: Re: Can't get my command line option via GetOpt::Long




Re: Can't get my command line option via GetOpt::Long
country flaguser name
United States
2007-02-21 15:21:54
Well, I'll be jiggered. Flaw in the example I used....

Thanks, Paul.

Eric

--- In perl-beginner@yahoogroups.com, Paul Archer
<tigger...> wrote:
>
> 8:32pm, Eric Roellig wrote:
> 
> > $ cat colors.pl
> > #!/usr/bin/perl  -W
> >
> Don't forget 'use strict;'
> 
> > {
> > # import module
> > #include <getopt_long.h>;
> > use Getopt::Long;
> >
> > my $result=0;
> > my $red = '';
> > my $blue = '';
> > my $green = '';
> >
> > print (" Argument is: $ARGV[0]n");
> >
> >
> > # read options
> > $result = GetOptions (  "red!" =>
$red,
> >                        "blue" =>
$blue,
> >                        "green" =>
$green );
> >
> 
> You're pretty close. But you need to pass a reference
to the 
variable, not 
> the content of the variable:
> 
> "blue" => $blue,
> 
> 
> Paul
>




------------------------ Yahoo! Groups Sponsor
--------------------~--> 
Something is new at Yahoo! Groups.  Check out the enhanced
email design.
http://us.click.yahoo.com/kOt0.A/gOaOAA/yQLSAA/ndFolB/TM

------------------------------------------------------------
--------~-> 

Unsubscribing info is here: h
ttp://help.yahoo.com/help/us/groups/groups-32.html 
Yahoo! Groups - Join or create groups, clubs, forums
&amp; communities. Links

<*> To visit your group on the web, go to:
    http://g
roups.yahoo.com/group/perl-beginner/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http
://groups.yahoo.com/group/perl-beginner/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:perl-beginner-digest@yahoogroups.com 
    mailto:perl-beginner-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    perl-beginner-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups - Join or create groups,
clubs, forums &amp; communities. is subject to:
    http://docs.yahoo.c
om/info/terms/
 

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )