in reply to Read file and remove whitespace
in thread Answer: Read file and remove whitespace
Your code got a little mangled in the HTML (use <code> tags next time).while ($line = <>) { my ($k, $v) = split /\s*=\s*/, $line, 2; $values{$k} = $v; }
I'm using split because what's before and after the = (and any surrounding whitespace) is irrelevant to the pattern -- what you really want to look for is that delimiter. split is natural for this job.
hdp.
|
|---|