in reply to Re^5: setting up boolean parameters from keywords
in thread setting up boolean parameters from keywords

AWESOME reply. Thank you! I did read experiment a bit before I came back. And got this to work...
$control[0]{"play"} = "/false/; $control[0]{"ctrl"} = "/false/; $control[0]{"loop"} = "/false/; % control = map { $_ => 'true' } split ' ', $4;
Which I understand much better after reading your post.

I like your version much more:
my %control = map { $_ => 'false' } qw(play ctrl loop); $control{$_} = 'true' for split ' ', $4;

(thanks for qw tip)

I don't understand in the 2nd to last example,
my %control = map { $_ => 'true' } split ' ', $4; %control = ((map { $_ => 'false' } qw(play ctrl loop)), %control);

why the hash is not reinitialized when the 'false's are applied. Isn't this your first caveat at the start of your post? I know it has something to do with the last %control...

I now also wonder how I would use flags and then assign specific values to the specific options w/o a lot of tests.
<code> # [src.mov -bfd] b=big, f=fast, etc.. %control = ((map { $_ => 'off' } qw(play ctrl loop)), %control); ?? Thanks Perl Monk!