in reply to Extracting strings around comparision operator
I was going to suggest 3-args split, but BrowserUK already did that. So here's another way using a regexp:
... if ($line =~ /^(\w+)=(["'])(.*)\2$/) { my $key = $1; my $value = $3; ... }
Basically it does the same as the 3-args split, but additionally it strips the quotes. (\2 refers to (["']) and makes sure the quotes are balanced)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Extracting strings around comparision operator
by Anonymous Monk on Aug 20, 2015 at 07:39 UTC | |
by Monk::Thomas (Friar) on Aug 20, 2015 at 08:09 UTC |