in reply to How can I create a "good" news script

Instead of trying to split on a character that might accidentally show up in your code, why don't you just serialize a data structure?

use strict; use warnings; use Storable qw/ freeze thaw /; use Data::Dumper; my %foo = ( one => [ qw/ a b c / ], two => [ qw/ 1 2 3 / ] ); my $serialized = freeze \%foo; my %clone = %{ thaw $serialized }; print Dumper \%clone;

It's much cleaner that way and you can store it in your database quite nicely (rethinking the database design is better, though).

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

Replies are listed 'Best First'.
Re: (Ovid) Re: How can I create a "good" news script
by TGI (Parson) on Jan 01, 2002 at 01:55 UTC

    Or possibly use a DBM interface that handles serialization for you, like MLDBM. If you are worried about file locking and concurrancy, you can also use MLDBM::Sync. MLDBM has saved me a lot of work.


    TGI says moo