Loading ...
Sorry, an error occurred while loading the content.
 

Re: [PBML] Can't get my command line option via GetOpt::Long

Expand Messages
  • Eric Roellig
    Well, I ll be jiggered. Flaw in the example I used.... Thanks, Paul. Eric ... variable, not
    Message 1 of 3 , Feb 21, 2007
      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
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.