in reply to Re^2: Loosing variable content after regular expression
in thread Loosing variable content after regular expression

In general, it's a Good Idea to "capture the capture variables" immediately after a match in order to avoid these kinds of strange problems:

if ($string =~ m{ (foo|bar) (\d+) (w[ia]g) }xms) { my ($one, $two, $three) = ($1, $2, $3); do_something_with($one); ... }
or:
if (my ($one, $two, $three) = $string =~ m{ (foo|bar) (\d+) (w[ia]g) } +xms) { do_something_with($one); ... }