1

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?

1
  • 2
    And why does it need to be Perl source code, and not just a data file in a format like JSON or YAML you can slurp in safely in the future? Commented Dec 3, 2013 at 14:21

2 Answers 2

2

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

Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.