Cool/useful short examples of Perl?

Uri Guttman uri at
Mon May 30 18:10:24 BST 2011

>>>>> "D" == Denny  <2011 at> 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 Guttman  ------  uri at  -------- --
-----  Perl Code Review , Architecture, Development, Training, Support ------
---------  Gourmet Hot Cocoa Mix  ---- ---------

More information about the mailing list