MARTIN MOSS wrote: > All, > > Hope everyone's having a pleasant day! > > I have a really urgent problem which I just can't seem > to resolve. > > I have a data structure, which I want to write out to > a file. The file I'd like to write would actually be a > perl file which I can 'require' at a later date, after > it's been manually edited. > > The format of the output hash I wish to write is:- > > $hash= { > 'key' => { > 'original_value' > =>$original_value', > 'new_value' => '$original_value', > > 'files' => [ > '$file1','$file2' > ] > }, > }; > > Where $original_value & the $file1,$file2 values can > contain ANY character.
I'm not sure if your hash is literal, but you don't want quotes around $original_value, $file1 and $file2. > I could write my own regex replacements for things > like Brackets and anything else which would prevent > the compilation of the 'requirable' file. But I > suspect that I've probably missed something out and > there's a nice CPAN module (which I haven't found) or > something else I should be using instead. Are you trying to replace the hash in the file or just write it to the file ? If you're trying to replace it, I would bracket the hash code in a pair of comment lines : ####### REPLACE HASH START ################ $hash= { 'key' => { 'original_value' => $original_value, 'new_value' => $original_value, 'files' => [ $file1, $file2 ], }, }; ####### REPLACE HASH EBD ################ -- ,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED] (_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED] / ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/ -/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff) _______________________________________________ Perl-Unix-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs