|
Posted by Curtis on 11/27/06 10:29
If you perldoc Data::Dumper, you'll see that you can use its procedural
interface, thanks to perl's use of namespaces:
Quoted from perldoc:
use Data::Dumper;
# simple procedural interface
print Dumper($foo, $bar);
As you can see, the module has a procedural interface. I noticed the
author of this thread started the same one in comp.lang.perl.modules,
if anyone's interested.
Also, note that if you want to dump an array or hash with the
Data::Dumper module, you need to pass it as a reference:
my %hash = ('a'=>'foo', 'b'=>'bar', 'c'=>'baz');
print Dumper(\%hash);
Curtis
Petr Vileta wrote:
> <larry@portcommodore.com> píse v diskusním príspevku
> news:1164517087.592391.20950@l39g2000cwd.googlegroups.com...
> >
> > Mark wrote:
> >> Many PHP function replicate Perl functions, but what about the other way
> >> around. Is there anything for Perl that does what the print_r()
> >> function does in PHP?
> >>
> >> Mark
> >
> > Google for:
> >
> > print_r() perl
> >
> > and you get some leads.
> >
> Of course, Data::Dumper but this is a module not Perl function. Module is
> similar to PHP class ;-)
> --
>
> Petr Vileta, Czech republic
> (My server rejects all messages from Yahoo and Hotmail. Send me your mail
> from another non-spammer site please.)
Navigation:
[Reply to this message]
|