in reply to Making debug a little more intelligent

I'd use:

my $debug = 2; # This is level 3 information if ($debug >= 3) { print DEBUG "LEVEL 3: bar\n"; } # This is level 2 information if ($debug >= 2) { print DEBUG "LEVEL 2: foo\n"; } # This is level 1 information if ($debug >= 1) { print DEBUG "LEVEL 1: moo\n"; }

Replies are listed 'Best First'.
Re: Re: Making debug a little more intelligent
by ibanix (Hermit) on Dec 10, 2002 at 23:08 UTC
    I was going to do that, but it seemed so... like C. :-P

    That was a joke.

    $ echo '$0 & $0 &' > foo; chmod a+x foo; foo;
Re^3: Making debug a little more intelligent
by Aristotle (Chancellor) on Dec 11, 2002 at 15:29 UTC
    $debug and print 1 == $debug ? "LEVEL 1: moo\n" : 2 == $debug ? "LEVEL 2: foo\n" : "LEVEL 3: bar\n";

    Makeshifts last the longest.