Cool/useful short examples of Perl?

Denny 2011 at denny.me
Mon May 30 17:13:35 BST 2011


On Mon, 2011-05-30 at 11:59 -0400, Uri Guttman wrote:
> from the File::Slurp synopsis. can't get much cooler, short or useful
> than this. :)
>   my %conf = read_file( $file_name ) =~ /^(\w+)=(\.*)$/mg ;
>   write_file( $file_name, {atomic => 1}, map "$_=$conf{$_}\n", keys %conf ;

It's kind of horrific looking though, and potentially fragile.  Is there
a less hideous way of doing it with another module?  Config::Any covers
the read but not the write...

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part
Url : http://london.pm.org/pipermail/london.pm/attachments/20110530/97d59d57/attachment.pgp


More information about the london.pm mailing list