in reply to array issue
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: array issue
by jonadab (Parson) on Jan 24, 2004 at 01:56 UTC |