in reply to Obtain $data_ref from eval'ed input file that was filtered to look like Perl code

Ah! It's a Doh! moment for me.

Just slurp in the filtered file and eval. Thanks, kyle & massa.

What if the filtered file is massive? { Slurp & eval $slurped } will be less efficient than { write file & do 'file' }, no?

Replies are listed 'Best First'.
Re^2: Obtain $data_ref from eval'ed input file that was filtered to look like Perl code
by Fletch (Bishop) on Aug 05, 2008 at 21:20 UTC

    Probably, but then again if you're at that point then the inefficiency of having that much live data is probably going to be the bigger issue (and you'd want to look at moving instead to something like DB_File or a real database instead of kludging it with a hash in memory.

    (Might also look at having both sides produce something like yaml instead of playing games with filtering and eval (or even filter to YAML rather than Perl and load that instead).)

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

      Thanks, Fletch. Yes, if the data was that unwieldy, then a database would be the way to go. And then I would have to parse the input file anyway to populate the database.