data-dumper

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

允我心安 提交于 2020-01-16 00:43:30
问题 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" that are printed out as "r\x{e9}cente". If I write just : print OUT %w; I've no problems, so "récente" it will be printed out as "récente". All text files used for the script are in utf8. Moreover I use the module "utf8" and I specify always the

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

你说的曾经没有我的故事 提交于 2020-01-01 03:38:06
问题 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 = <FILE>; } eval $vars; But it didn't seem to work -- $x not only isn't defined, when I try to use it I get a warning that Global symbol $x requires explicit package name. What's the right way to do this? (And yes, I know it's ugly. It's a quick utility script, not

How to deserialize Perl Data::Dumper output in PHP

偶尔善良 提交于 2019-12-22 05:33:31
问题 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, 'extension' => 'jpg', 'filename' => 'object_1.1330907414.96873.jpg', 'mini_width' => 150, 'class' => 'Ontico::Image', 'height' => 150, 'mini_filename' => 'object_1.1330907414.96873.mini.jpg', 'size' => 26053, 'symname' => 'big_logo' }, '2' => { 'width' => 48, 'extension' => 'jpg', 'alt' => 'Даниэле Галлоппа', 'height' => 48,

Querying multiple times in Oracle using perl returns only the first query

蹲街弑〆低调 提交于 2019-12-20 07:48:13
问题 Note: I have corrected the variable differences and it does print the query from the first set but it returns nothing from the second set. If I use the second set only it works. In the code below, I have some_array which is array of array the array contains text like name. So @some_array= ([sam, jon, july],[Mike, Han,Tommy],[angie, sita, lanny]); Now when I querying the list like 'sam jon july' first and 'mike han tommy' . Only the execute return the result from the first list others is undef

Using Dumper not triggering a failure

你离开我真会死。 提交于 2019-12-19 04:18:29
问题 when running code like this: use strict; print Dumper "something"; nothing is printed out and no error occurs during compile and runtime. Why does this happen? Why doesn't strict prevent this code from running? Why is there no error at runtime, even though Dumper is unknown? I know it produces a warning when those are explicitly enabled, but I'm interested why is this code considered "correct" in any way. 回答1: One of the valid syntaxes for print is print FILEHANDLE LIST In your program Perl

Obtaining a value from a nested hash/array data structure

梦想与她 提交于 2019-12-13 02:52:53
问题 I am doing some API queries using Perl and using Data::Dumper to print the contents and hopefully assign several keys as variables. $client->request( "GET", "interfaces/detail", $opts ); my $out = decode_json $client->responseContent(); print Dumper $out; However, I am unable to print a specific key's (b4) output or define it as a variable. print $out{'b4'}; I think that this is due to the nested data structure of HASH/ARRAY/HASH/HASH/Key=>Value in JSON format. DB<1> x $out 0 HASH(0x493f290)

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

元气小坏坏 提交于 2019-12-11 09:35:15
问题 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 ( @contents ) { print Dumper($contentry) ."\n"; } This prints something like: $VAR1 = bless( \*Symbol::GEN298, 'IO::All::File' ); $VAR1 = bless( \*Symbol::GEN307, 'IO::All::Dir' ); $VAR1 = bless( \*Symbol::GEN20, 'IO::All::File' ); ... I expected I would get the all the fields of the

Is there a less verbose alternative to Perl's Data::Dumper?

青春壹個敷衍的年華 提交于 2019-12-11 00:59:53
问题 I'm trying to print some parse trees, and Data::Dumper is very verbose for that, for example printing: { 'A' => { 'ID' => 'y' }, 'OP' => '=', 'B' => { 'NUM' => '5' } }, rather than let's say: { 'A' => {'ID' => 'y'}, 'OP' => '=', 'B' => {'NUM' => '5'} }, and it's very hard to read since it take massive number of lines. Is there any Perl library which does what Data::Dumper does except more tersely, or do I need to write my own? 回答1: You want Data::Dump : HISTORY The Data::Dump module grew out

Perl hash Data::Dumper

 ̄綄美尐妖づ 提交于 2019-12-10 01:37:02
问题 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, I will be able to see immediately key structure where the string I am looking for is stored? Currently I am using just a simple code: use Data::Dumper; ... print Dumper $var; What is the best syntax or alternative to get nice output? 回答1: I almost

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

ぐ巨炮叔叔 提交于 2019-12-07 03:35:54
问题 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? 回答1: Take a look at Data::Dump for something similar to Data::Dumper but arguably better at pretty printing. Edit (20120304) : I had completely forgotten this question, but it was upvoted today and that jogged my memory. If I had to recommend anything today (3 years later) for pretty printing in Perl, I would certainly go