|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Hi all
Is there a replacement for the var_dump function of PHP in Perl? I ask only because for what I've understood, Perl is not so user friendly as PHP and that's why such a function can become even more handy than ever.
__________________
-- Tomi Kaistila -- Developer's Journal The more you learn, the more you know. The more you know, the more you forget. The more you forget, the less you know. |
|
#2
|
||||
|
||||
|
The aptly named Data::Dumper should be what you're looking for.
Code:
use Data::Dumper; #create data structure here print Dumper($your_data_structure); This will print 'eval'-able stringyfied versions of your data. Read the man page, this is a pretty simple module. |
|
#3
|
||||
|
||||
|
My thanks to you Hero Zzyzzx. Do I need to install an additional module for that or can I just go on and use it at whim? I'm afraid I cannot access man pages, 'cause I'm running windows. Could you possible supply me a copy?
|
|
#4
|
||||
|
||||
|
It might already be installed on your system. Just put "use Data:
umper" in your script and see if it throws out an error.You can find man pages online at www.perldoc.com The specific one you want is: http://www.perldoc.com/perl5.6.1/lib/Data/Dumper.html |
|
#5
|
||||
|
||||
|
Not to sound too impatient, but if you're using ActiveState (which most likely you are, if you're doing perl coding on windows), all the perl documentation is included in a standard install. No need to go online.
Data: umper is also included with ActiveState. |
|
#6
|
||||
|
||||
|
My thanks to you. I'm sorry for my questions, just starting to get a hang on this stuff. You know what they say, "there are no stupid questions, only stupid people"
![]() |
|
#7
|
|||
|
|||
|
You can always use ppm to install most perl modules in windows anyway (type 'ppm' from the command line). Data::Dumper is a very nice one to have installed at all times.
__________________
Jon Coulter ledjon@ledjon.com |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > Dumping variables |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|