qw with strings containing spaces
- From: theillien@xxxxxxxxx (Mathew Snyder)
- Date: Thu, 09 Aug 2007 14:58:52 -0400
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
--
Keep up with me and what I'm up to: http://theillien.blogspot.com
.
- Follow-Ups:
- Re: qw with strings containing spaces
- From: John W. Krahn
- Re: qw with strings containing spaces
- From: usenet
- Re: qw with strings containing spaces
- From: Flemming Greve Skovengaard
- Re: qw with strings containing spaces
- Prev by Date: Re: Find and replace from CSV
- Next by Date: Calculating Column Averages from a CSV File
- Previous by thread: xml rpc version for perl 5.005
- Next by thread: Re: qw with strings containing spaces
- Index(es):
Relevant Pages
|