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
3
votes
2 answers

Can't use string as an ARRAY ref while strict refs in use

Getting an error when I attempt to dump out part of a multi dimensional hash array. Perl spits out Can't use string ("somedata") as an ARRAY ref while "strict refs" in use at ./myscript.pl I have tried multiple ways to access part of the array I…
carclubadmin
  • 151
  • 3
3
votes
2 answers

Perl: Checksum of complex data-structure

Is there a package/function in Perl that gives me in an easy way a short information (e.g. a number, short string) like a hashvalue/checksum (e.g. MD5) with good distinction (e.g. cryptographic hash like MDx, SHAx) representing the content of a…
chris01
  • 10,921
  • 9
  • 54
  • 93
3
votes
2 answers

Getting Data::Dumper Object print error

Problem: I am trying to print the $self object to know the contained data structure like below line and getting the error: use Data::Dumper; my $self = shift; print Dumper($self); Error: Can't locate object method "FIRSTKEY" via package…
AbhiNickz
  • 1,035
  • 2
  • 14
  • 32
3
votes
3 answers

Data::Dumper wraps second word's output

I'm experiencing a rather odd problem while using Data::Dumper to try and check on my importing of a large list of data into a hash. My Data looks like this in another file. ##Product ID => Market for product ABC => Euro XYZ => USA PQR =>…
Jon Bot
  • 87
  • 6
3
votes
3 answers

Perl persistent data storage using Data::Dumper

I have been trying to figure this out for way to long tonight. I have googled it to death and none of the examples or my hacks of the examples are getting it done. It seems like this should be pretty easy but I just cannot get it. Here is the…
stephenmm
  • 2,640
  • 3
  • 30
  • 48
3
votes
1 answer

Data::Dumper numeric sort on first level key of HoH using Sortkeys sub

I have a HoH data structure. The outer level hash's keys are numeric - so I'd like to Dump the HoH numerically sorted by the first hash key (I don't care about the order of the inner hash). I've been trying different Sortkeys subs: use…
CraigP
  • 453
  • 1
  • 3
  • 17
3
votes
1 answer

Using xml::simple - unable to get specific format output

Input file :SN.xml value1 I am using these code for…
Vasanth
  • 201
  • 1
  • 12
3
votes
3 answers

How to read back a file written using Data::Dumper (but not with the default VAR naming)?

I have written a hash structure into a file using print FILE Data::Dumper->Dump([$x], [ qw(*x) ]); How do I read this back from file? If I use eval as shown in the following snippet, all I get is $VAR1 = undef; local $/; $hash_ref = eval ;
srk
  • 75
  • 1
  • 4
3
votes
2 answers

Perl Data::Dumper hashes inside array?

I have a program that parses some XML using XML::Simple. It appears at some point the XML has redundant entries in it that get serialized, but I can't for the life of me figure out how to get that data back as a simple string. There is a subset of…
szumlins
  • 161
  • 1
  • 3
  • 8
3
votes
3 answers

I serialized my data in Perl with Data::Dumper. Now when I eval it I get "Global symbol "$VAR1" requires explicit package name"

I serialized my data to string in Perl using Data::Dumper. Now in another program I'm trying to deserialize it by using eval and I'm getting: Global symbol "$VAR1" requires explicit package name I'm using use warnings; use strict; in my…
bodacydo
  • 75,521
  • 93
  • 229
  • 319
2
votes
3 answers

perl printing hash of arrays with out Data::Dumper

Here is the code, I know it is not perfect perl. If you have insight on how I an do better let me know. My main question is how would I print out the arrays without using Data::Dumper? #!/usr/bin/perl use Data::Dumper qw(Dumper); use strict; use…
Matthew Hoggan
  • 7,402
  • 16
  • 75
  • 140
2
votes
4 answers

I don't want to use Data::Dumper's default settings, what can I do?

I find myself using this method to print out Perl values all the time: sub d { Data::Dumper->new([])->Terse(1)->Indent(0)->Values([$_[0]])->Dump; } say "x = ", d($x), ' y = ', d($y); I like this because I don't want $VAR1 = in my output, and I…
perlman
  • 139
  • 4
2
votes
1 answer

Perl Data::Dumper output processing

I am using the DATA::Dumper api to parse an html table.. Here is the perl code: print Dumper $row; Here is the output: $VAR1 = [ 'Info1', 'Info2', 'Info3', ]; Question: 1. I want to modify Info1, Info2, etc…
Simbatish
  • 21
  • 1
2
votes
1 answer

Parsing hash in perl to CSV format

I need to parse my text file (my output) to csv format, which contains just Names and Ips from devices. Somthing like: Name, ip LAB-W, 10.66.1.12 LAB-D, 10.66.1.13 I do not have experience with parsing in perl, maybe somebody can help me with this…
StayCalm
  • 145
  • 2
  • 13
2
votes
2 answers

Conditional load of Data::Dumper::Simple not working

I'm using Data::Dumper and Data::Dumper::Simple (DD and DDS) to print hashes in a verbose mode of a script, and I want to be able to share it with others who may not have those modules installed, so I'm checking that they're loaded. Without…
SSilk
  • 2,433
  • 7
  • 29
  • 44