Question

I am parsing some website(s) to get some information list that I store into an array of strings. I need to generate .pm code where this list will be defined as a Perl variable. As such strings in the array may contain any ASCII character, I need to ensure that there would be no conflict with Perl syntax. What is the best and safest way to convert such array into Perl source code?

Was it helpful?

Solution

You can try Storable or Data::Dumper with $Data::Dumper::Useqq = 1.

OTHER TIPS

I suggest to use: FreezeThaw

It can freeze and thaw any element you want (or at least anything that doesn't have pointers to active objects).

If needed it also allow you to modify the freezer and thawer so that you can store data the regular function doesn't support.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top