开发者

quivalent function like print_r() [duplicate]

This question already has answers here: 开发者_StackOverflow Closed 12 years ago.

Possible Duplicate:

What is Perl's equivalent to PHP's print_r()?

is there equivalent function like print_r() in perl ,


There is the Data::Dumper module (which is core module):

use Data::Dumper;

my $var = {'a' => 'Apfel', 'b' => 'Banane', 'c' => ['x', 'y', 'z']};

print Dumper($var);

Gives for the above example:

$VAR1 = {
          'c' => [
                   'x',
                   'y',
                   'z'
                 ],
          'a' => 'Apfel',
          'b' => 'Banane'
        };

which can be eval'ed back into Perl.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜