debug prints a debugging message to stdout as long as LEVEL is at or below the "debug" level. (see <debuglevels).

The debug message is printed in BOLD. It starts with "Debug: ", then STRING, and then optionally uses Data::Dumper to dump a data structure referred to by REF. NAME is just a human readable name for REF passed to Data::Dumper.

To make things marginally more useful, you can specify that a message can be printed to stdout based on more than one level by specifying a list of levels.

For instance, for debug you can also specify the "verbose" and "test" levels at which the debug message will be printed. In the following example, the debug message will be output at debug levels 1-2, verbose levels 1-3 or test level 1.

&debug([2,3,1], "This is a debug message\n");

In this case, the message will be printed to stdout if the verbose level is 1-2 or test level 1.