On 2012-11-15 03:07, Uri Guttman wrote:

     my %hash = read_file( 'file.txt' ) =~ /^(.+)\s*=>\s*(.+)$/mg ;

Trailing whitespace in the keys? Skipping empty values?

  my %kv= read_file( 'file.txt' ) =~ /^(.+?)\s*=>\s*(.*)/mg;

and without File::Slurp:

  my %kv= map m/(.+?)\s*=>\s*(.*)/, <$fh>;

(all untested)

--
Ruud


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to