Cool/useful short examples of Perl?

Uri Guttman uri at StemSystems.com
Mon May 30 16:59:17 BST 2011


from the File::Slurp synopsis. can't get much cooler, short or useful
than this. :)


# Here is a simple and fast way to load and save a simple config file
# made of key=value lines.

  my %conf = read_file( $file_name ) =~ /^(\w+)=(\.*)$/mg ;
  write_file( $file_name, {atomic => 1}, map "$_=$conf{$_}\n", keys %conf ;


-- 
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