in reply to DEBUG levels <perl formats>

i want to have warnings/trace based on cmdline Options.
xxx.pl --help -d displays complete debuging statements. -e display db debuging statements. -f displays only errors.

The way I'd doit is like thus:

  1. map your cmd lines args into suitable flag variables;
  2. just add some warn statements complete of an if $flag modifier.

But that's not the whole story: for a more integrated approach write a, say, warning() sub which accepts a first argument that is to describe a severity level. Then your command line arguments may set a suitable "global" $severity variable, and warning() should either emit the warning (the other arguments) or ignore it althogether depending on whether the severity is equal or lower than that set by $severity.

But that's not the whole story yet: for some computation intensive subs where performance may matter, I would probably alias them into the stash depending on the severity level, but that's an extreme corner case.