On 11-02-09 04:52 PM, gry wrote:
[[v5.8.8 built for x86_64-linux-thread-multi]
#!/usr/bin/perl -W
use Getopt::Long;
my $dml = 0;
my $iterations = 10;

my %options = ("dml!" =>  \$dml,
               "iterations=i" =>  \$iterations);
GetOptions(%options) || die "bad options";
printf "dml=$dml\n";
print %options;
foreach $key (sort keys %options) {
     printf "$key: $options{$key}\n";}

This script prints:
dml=0
dml!SCALAR(0xa461540)iterations=iSCALAR(0xa461560)dml!:
SCALAR(0xa461540)
iterations=i: SCALAR(0xa461560)

How can I get readable output of my getopt options without manually
enumerating them?



With Getyopt::Long, the value of the options is in the variable:

print "\$dml = $dml\n";
print "\iterations = $iterations\n";


--
Just my 0.00000002 million dollars worth,
  Shawn

Confusion is the first step of understanding.

Programming is as much about organization and communication
as it is about coding.

The secret to great software:  Fail early & often.

Eliminate software piracy:  use only FLOSS.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to