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
1
vote
3 answers

Perl - Use Data::Dumper to write back to a file

I have a large .csv file (2 - 3 million records). I need to concatenate the first three fields (with underscores) and append it to each record, then I need to sort file based on that new field and three other fields. I am able to do that (am…
BigRedEO
  • 807
  • 4
  • 13
  • 33
1
vote
2 answers

Perl eval Data::Dumper inconsistency

I have to serialize and deserialize in Perl. I am aware that Data::Dumper and eval are not the best suited ones for this job but I am not allowed to modify this aspect in the legacy scripts which I am working on. Below are two ways ( CODE 1 and CODE…
gsinha
  • 1,165
  • 2
  • 18
  • 43
1
vote
0 answers

Python dumper.dump() dumps class information in the shell, but not in scripts

I'm new to Python, happily transitioning from Perl where I rely a lot on Data::Dumper. I'm trying to get dumper.dump() to dump info on a class from within a script. It works fine from the shell. From within a script, dump() just shows the class…
1
vote
2 answers

perl JSON decode is not giving expected result

I have below JSON input - {"links":{"self":"/some/path"},"data": [{"type":"some_service","id":"foo","attributes": {"created":true,"active":true,"suspended":false}}, {"type":"some_service","id":"dummy","attributes":{"created":false}}]} I am…
CodeQuestor
  • 881
  • 1
  • 11
  • 25
1
vote
1 answer

Dump Perl hash into new txt file every time script runs

I have a Perl script that dumps a hash into an 'output.txt' file. The problem is, every time I run this script, the same 'output.txt' file gets overwritten. How do I generate a new '.txt' file every time I run the script so that I have the results…
chmod
  • 85
  • 1
  • 9
1
vote
2 answers

Making more of Perl Data::Dumper output

I have several nested data structures that refer to one another's elements. I would like to be able to check those references, so I am searching for something that will print the memory address of nested structures. An option for Data::Dumper would…
Wakan Tanka
  • 7,542
  • 16
  • 69
  • 122
1
vote
1 answer

How to get Perl Data::Dumper to follow references that are hash keys

Data::Dumper doesn't seem to expand references that are hash keys, and I can't figure out what settings to change to make it do so. Is this even possible? Example code: #!/usr/bin/perl use Data::Dumper; @array = ('foo', 'bar'); $arf =…
onigame
  • 214
  • 3
  • 10
1
vote
1 answer

Printing the return of IO::All with Data::Dumper?

Consider this snippet: use Data::Dumper; @targetDirsToScan = ("./"); use IO::All; $io = io(@targetDirsToScan); # Create new directory object @contents = $io->all(0); # Get all contents of dir for my $contentry (…
sdaau
  • 36,975
  • 46
  • 198
  • 278
1
vote
4 answers

Accents not respected in printing out with data::dumper PERL

I would like to print out the content of an associative array. For this I'm using Data::dumper. So, for exemple, if the associative array is called "%w", I write : print OUT Dumper(\%w); Here's the problem: there are some words like "récente"…
KeyPi
  • 516
  • 5
  • 20
1
vote
2 answers

Perl object, toString output from within module

I'm doing a class assignment to learn about Object Oriented programming in Perl. I've got a real basic class that looks like this. sub new{ my $class = shift; my $self = { 'Sides' => 3, 'SL' => \@sidelengths}; bless $self, $class; …
user2829377
  • 47
  • 1
  • 5
1
vote
5 answers

Is there a safe way of using eval to unthaw Data::Dumper output in Perl?

I have an object that uses freezes data as such: sub frozen_data { my $self = shift; $Data::Dumper::Indent = 0; $Data::Dumper::Terse = 1; return Data::Dumper->Dump( [ $self->{_DATA}, ] ); } and a corresponding thaw: sub thaw_data…
Timmy
  • 12,468
  • 20
  • 77
  • 107
1
vote
1 answer

How to log res.locals content in console with ExpressJS and Nodejs for debugging?

I'm working on an application using Node.js and ExpressJS and I'm a beginner on this environment. I have the basic need of logging the entire or partial res.locals's content in my console for debugging. I've tried this : var foo_route =…
smonff
  • 3,399
  • 3
  • 36
  • 46
0
votes
2 answers

How do I work with just one key and value from Data::Dumper output

I have data dumper outputting a remotely hosted xml file into a local text file and I am getting the following info: $VAR1 = { 'resource' => { '005cd410-41d6-4e3a-a55f-c38732b73a24.xml' => { 'standard' => 'DITA', …
Hedley Phillips
  • 389
  • 1
  • 8
  • 16
0
votes
1 answer

Perl: unexpected results determining if a key is in a hash

Using Perl v5.22.1 on Windows 10 x64. I have set use strict; use warnings; This code (based on accepted answer in this question by @Jeef) is part of a while loop parsing a file. It silently exits: my %hvac_codes; # create hash of unique HVAC…
tim11g
  • 1,935
  • 5
  • 27
  • 41
0
votes
2 answers

How can I combine Data::Dumper and Statistics::Diversity::Shannon into a whole loop?

I want to combine this two functions together to get Shannon Diversity Index. How can do ? The first function is using Data::Dumper to get the unique numbers. #!perl use warnings; use strict; use Data::Dumper; $Data::Dumper::Sortkeys=1; my…
Chen Leo
  • 17
  • 4