Cool/useful short examples of Perl?
Uri Guttman
uri at StemSystems.com
Mon May 30 18:10:24 BST 2011
>>>>> "D" == Denny <2011 at denny.me> writes:
D> 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 ;
D> It's kind of horrific looking though, and potentially fragile. Is there
D> a less hideous way of doing it with another module? Config::Any covers
D> the read but not the write...
the file format is the easiest to read/write. also that is the fastest
way to load/save a simple config file. those are parts of the usefulness
of those short lines. and if you think those are complex, you haven't
seen enough perl! :)
uri
--
Uri Guttman ------ uri at stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
More information about the london.pm
mailing list