my %options = (); while (<>) { my (undef, @options) = split /(\S+)\s*=/; %options = (%options, grep s/^\s*|\s*$//g, @options); }