Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Serialization and eval in YAML

by thundergnat (Deacon)
on Aug 13, 2012 at 18:15 UTC ( #987173=note: print w/ replies, xml ) Need Help??


in reply to Serialization and eval in YAML

use Data::Dumper;
@arg2 = [{a => 1, b =>2}], [qw($balloon)];
Data::Dumper->Dump(@arg2)

gives

'$balloon = {
             \'a\' => 1,
             \'b\' => 2
};

Really? Using no version of Perl that I've ever used.

use warnings; use Data::Dumper; @arg2 = [{a => 1, b =>2}], [qw($balloon)]; print Data::Dumper->Dump(@arg2)
Useless use of anonymous list ([]) in void context at dd.pl line 3.
$VAR1 = [
          {
            'a' => 1,
            'b' => 2
          }
        ];

Precedence problem. You need parenthesis around the array. And lose the sigil on $balloon.

Update: removed some unnecessarily snarky commentary.


Comment on Re: Serialization and eval in YAML
Download Code
Replies are listed 'Best First'.
Re^2: Serialization and eval in YAML
by Anonymous Monk on Aug 13, 2012 at 20:27 UTC
    use Data::Dumper; print Data::Dumper->Dump( [{a => 1, b =>2}], [qw($balloon)] ); __END__ $balloon = { 'a' => 1, 'b' => 2 };

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://987173]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (14)
As of 2015-07-30 16:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (273 votes), past polls