From: "Johannes Ernst" <[EMAIL PROTECTED]>

> PHP knows print_r -- which prints a data structure hierarchically,  
> and is very useful for debugging.
> e.g.
>      echo "Variable a is " . print_r( $a, true ) . "\n";
> 
> Is there something similarly easy in Perl?
> 
> It appears that Data::Dumper may be of help, but I have not been able  
> to figure out how to make the output reasonably compact (I don't want  
> to see the pseudo-hash index fields etc.)
> 

Have you read: ?
perldoc Data::Dumper

Maybe this is what you need:

    *   $Data::Dumper::Indent *or* *$OBJ*->Indent(*[NEWVAL]*)

        Controls the style of indentation. It can be set to 0, 1, 2 or 3.
        Style 0 spews output without any newlines, indentation, or spaces
        between list items. It is the most compact format possible that can
        still be called valid perl. Style 1 outputs a readable form with
        newlines but no fancy indentation (each level in the structure is
        simply indented by a fixed amount of whitespace). Style 2 (the
        default) outputs a very readable form which takes into account the
        length of hash keys (so the hash value lines up). Style 3 is like
        style 2, but also annotates the elements of arrays with their index
        (but the comment is on its own line, so array output consumes twice
        the number of lines). Style 2 is the default.




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to