Hi all. I have a long list of values which I want to put
into an array, but some of those values have spaces in them.
It would be easiest, I feel, if I could just use qw//, but
I can't figure out how to get around the splitting on
whitespace.
Right now, my best solution that I can think of would be
to use something in place of whitespace, and do a regex on
the array later:
my @array = ( qw/one two three four_and_a_half/ );
s/_/ /g for( @array );
But this could get rather cumbersome for large arrays, and
at some point in the future, I might need to use whatever
character I pick within an element of the array. (Well, okay, I can pick something
weird like \007, but ya never know.)
Is there another way to do this?
elbieelbieelbie
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.