You're inadvertently just splitting the input line on a space and putting the elements in an array. What you need to do is split the value of $1 (which is the string matched by the (\w+) part when you find a line that matches. So that part could be rewritten as
I'm assuming that after "NAME" there can also be multiple names.if (/^-- NAME:\s(.+)/) { @name = split(" ", $1); } if (/^-- TOYS:\s(.+)/) { @toys = split(" ", $1); }
Arjen
In reply to Re: array issue
by Aragorn
in thread array issue
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |