Mathew Snyder wrote:
I need to populate a select multiple on a web page when it loads with a series
of values. Most of the values will be determined dynamically when the code runs
but some are static. They look like "A - H", "I - P" and "Q - Z". The spaces
are for readability.
What I am doing is declaring an array and assigning the value:
@array = qw/All "A - H" "I - P" "Q - Z"/;
and then pushing the to-be-determined values onto the array later on. However,
when I print this all out while testing, I get each letter, hyphen and quote as
individual elements. I've tried escaping different ways to no avail.
I've looked on PerlMonks and saw a solution which created a scalar with a string
containing each item separated by commas. It is then run through the split()
function using the commas as the delimiter. I'd like a more succinct and
cleaner method of doing this though, if possible.
Any ideas?
Mathew
Why not just declare @array like this:
my @array = ("All", "A - H", "I - P", "Q - Z");
and then later push new variables onto it, like so:
push @array, qw/1 2 3/;
--
Flemming Greve Skovengaard FAITH, n.
a.k.a Greven, TuxPower Belief without evidence in what is told
<[EMAIL PROTECTED]> by one who speaks without knowledge,
4011.25 BogoMIPS of things without parallel.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/