Thread use if: ? (9 answers)
Opened by vayu at 2007-02-14 13:17

bloonix
 2007-02-14 13:37
#74320 #74320
User since
2005-12-17
1615 Artikel
HausmeisterIn
[Homepage]
user image
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
use strict;
use warnings;

BEGIN {
  $main::debug = defined $ARGV[0] ? $ARGV[0] : 0;
}

use if $main::debug, "Data::Dumper";

my $ref = {foo=>'bar'};

print Dumper($ref)
  if $main::debug;


#> ./test.pl 1
$VAR1 = {
         'foo' => 'bar'
       };


Eine weitere Lösung wäre noch require.\n\n

<!--EDIT|opi|1171453248-->
What is a good module? That's hard to say.
What is good code? That's also hard to say.
One man's Thing of Beauty is another's man's Evil Hack.

View full thread use if: ?