[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Omaha.pm] Getopt::Long and opt_ variables



In the second edition camel (on page 448), it says that" "If no linkage is 
explicitly specified and no hash ref is passed, GetOptions() will put the 
value of in a global variable named after the option preceded by opt_..." 
Is this automagically done? This example doesn't seen to work .

#!/usr/bin/perl -w

use strict;
use Getopt::Long;
my $opt_place;

&GetOptions("place=s");

print "Hello! $opt_place\n";

dthacker@fluffy:~/dev/dwofl/bin> ./test2.pl -place World Use of uninitialized 
value in concatenation (.) or string at ./test2.pl line 9. Hello!

DT