Try invoking this with and without the -D flag and note the behavior of
$DEBUG:
====================<test1.pl>====================
#!/usr/bin/perl -w
use Getopt::Std;
getopts('pDd:f:');
print "opt-D is: $opt_D\n";
# if it's on the command line w/no arg it gets a 1
$opt_D ? $DEBUG = 1 : $DEBUG = 0;
sub foo {
$DEBUG = shift;
}
====================<test2.pl>====================
Forgive me if this is a FAQ, or a 'feature', but it looks like
assignments aren't being carried out inside the 'x ? y : z'
thinger. Is this a bug?
-C
--
Einstein himself said that God doesn't roll dice. But he was wrong. And
in fact, anyone who has played role-playing games knows that God
probably had to roll quite a few dice to come up with a character like
Einstein. -- Larry Wall C. Abney
Migrated from rt.perl.org#951 (status was 'resolved')
Searchable as RT951$
The text was updated successfully, but these errors were encountered: