Questions tagged [data-dumper]

Data::Dumper is a Perl library for generating stringified representations of data structures, suitable for both printing and eval.

Data::Dumper is a Perl library for generating stringified representations of data structures, suitable for both printing and eval.

92 questions
12
votes
4 answers

Perl hash Data::Dumper

In Perl I need to analyze a huge hash, so I print it into a file using Data::Dumper module. Because it is a huge file, it is very hard to read. Is it possible somehow to print Dumper output nicely, so when I will find a string that I am looking for,…
Ωmega
  • 42,614
  • 34
  • 134
  • 203
12
votes
4 answers

How do I control the variable names in Perl's Data::Dumper?

I've got this simple Perl script: #! /usr/bin/perl -w use strict; use Data::Dumper; my %foo = ( 'abc' => 1 ); print Dumper(\%foo); It outputs: $VAR1 = { 'abc' => 1 }; How do I make it output this instead? %foo = ( …
raldi
  • 21,344
  • 33
  • 76
  • 86
9
votes
2 answers

How to prevent printing the variable name using `Data::Dumper`

I'm using Data::Dumper to print a perl hash with configuration, which will be evaluated by another script. The problem is that it always prints $VAR = at the start of output. I tried settings the Varname parameter to empty string, but then i get $1…
Mariusz Jamro
  • 30,615
  • 24
  • 120
  • 162
9
votes
3 answers

In Perl, how can I write the output of Dumper to a file?

How can I make Data::Dumper write a dump into a file?
joe
  • 34,529
  • 29
  • 100
  • 137
7
votes
3 answers

How to display readable UTF-8 strings with Data::Dumper?

I have some UTF-8 encoded strings in structures which I am dumping for debugging purposes with Data::Dumper. A small test case is: use utf8; use Data::Dumper; say Dumper({да=>"не"} It outputs { "\x{434}\x{430}" => "\x{43d}\x{435}" }; but I want…
Беров
  • 1,383
  • 10
  • 22
7
votes
1 answer

What is difference between Data::Dump and Data::Dumper modules in Perl?

I have been using Data::Dumper for long times. While searching on google, I found one more similar module Data::Dump. Can anyone let me know, what are the major differences between the subroutines provided by them?
Kamal Nayan
  • 1,890
  • 21
  • 34
7
votes
7 answers

How can I control the formatting of Data::Dumper's output?

I am using Data::Dumper::Dumper() method. The output is good, but can be made little compact and more good looking. How I can control it? What are the better alternatives?
aartist
  • 3,145
  • 3
  • 33
  • 31
6
votes
2 answers

Display data from an array of objects

I'm trying to display data from an array of objects obtained using another company's API, but I am getting errors when I attempt to using a foreach loop. I'm using Dumper to display everything in the array. print Dumper($object); Partial output…
arcdegree
  • 2,710
  • 3
  • 27
  • 38
6
votes
2 answers

Perl's Data::Dumper shows objects instead of values

foreach my $row (1..$end) { foreach my $col (3..27 ) { # skip empty cells next unless defined $worksheet->Cells($row,$col)->{'Value'}; # print out the contents of a cell $var =…
Melissa
  • 99
  • 2
  • 8
6
votes
6 answers

How to deserialize Perl Data::Dumper output in PHP

I have a result of export variable in Perl like this string: $VAR1 = { 'guard' => undef, 'work_hand' => undef, 'images' => {'1' => { 'mini_height' => 150, 'width' => 150, …
Dimmduh
  • 803
  • 1
  • 11
  • 18
5
votes
9 answers

How do I read back in the output of Data::Dumper?

Let's say I have a text file created using Data::Dumper, along the lines of: my $x = [ { foo => 'bar', asdf => undef }, 0, -4, [ [] ] ]; I'd like to read that file back in and get $x back. I tried this: my $vars; { undef $/; $vars =…
mike
  • 46,876
  • 44
  • 102
  • 112
5
votes
1 answer

Data::Dumper::Simple usage

Just interested: Is there a way to do the second form of Dumper in this following snippet? use Modern::Perl; use Data::Dumper::Simple; my $data = { name => 'jim', age => 21, updated => time() }; my $timestr = localtime($data->{updated}); say…
Richard
  • 2,994
  • 1
  • 19
  • 31
4
votes
1 answer

How do I control the whitespace in Perl's Data::Dumper?

For Data::Dumper, we have options for indentation: $Data::Dumper::Indent = 1; I don't prefer 2 or 3. In option 1, it was 2 whitespace added. Can I change?
4
votes
1 answer

Perl Json encoding has quotes for float

perl version 5.18 I am having an issue with the perl JSON encoder and putting quotes around a float. see sample code: use JSON; use Data::Dumper; my $float = 1.2; my $t = { float => $float }; my $json1 = encode_json($t); print Dumper $t; my…
clintonm9
  • 181
  • 1
  • 1
  • 6
3
votes
1 answer

in perl, why does sprintf(Dumper \%hash) throw a warning when the hash contains a long string?

I have been using syntax like the following for months, without triggering a warning: die join('', sprintf(Dumper [@stack]), sprintf(Dumper {%oprAtnNOW}), 'opt tojudge not specified'); That is, I have used sprintf with Dumper, without specifying a…
Jacob Wegelin
  • 1,304
  • 11
  • 16
1
2 3 4 5 6 7