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 program.
Here is how I'm eval
ing the code:
my $wiki_categories = eval($db_row->{categories});
die $@ if $@;
/* use $wiki_categories */
How can I disable my program dying because of "$VAR1"
not being declared as my
?
Should I append "my "
before the $db_row->{categories}
in the eval
? Like this:
my $wiki_categories = eval("my ".$db_row->{categories});
I didn't test this yet, but I think it would work.
Any other ways to do this? Perhaps wrap it in some block, and turn off strict for that block? I haven't ever done it but I've seen it mentioned.
Any help appreciated!