On 5/3/10 Mon  May 3, 2010  9:35 AM, "Harry Putnam" <rea...@newsguy.com>
scribbled:

[long problem description snipped]
 
> I'm doing that without involving Data::Dumper.
> 
> Do you think it would be better done using Data::Dumper?
> 
> First I'd have to learn how to use Data::Dumper

The usual purpose of using Data::Dumper (DD) is to print out a complex data
structure to see what is there. This is only for debugging purposes. Once
you have a program working, you can delete all references to DD. However, it
is usually better to comment out the lines that use DD or use a conditional
flag to disable them, since you may need them in the future if you discover
a problem.

I don't think anybody is saying use Data::Dumper to implement your algorithm
or simplify your program. (There is another reason to use Data::Dumper -- to
store a data structure in a data file and reconstruct it in a later
invocation of a program, but that is not being suggested here, and there are
other modules that do that better.)

So create your hashes and implement your testing algorithms without using
Data::Dumper. Then use it to print your hashes if you are confused about
what they contain.

There is a package variable $Data::Dumper::Indent that you can set to change
how Data::Dumper formats its output. The default value is 2. I sometimes use
the following to get a more compact output:
    
    $Data::Dumper::Indent = 1;

See the Data::Dumper documentation for other options that affect the output.



-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to