Meidling, Keith, CTR, ISD wrote:
> UNCLASSIFIED
> 
> I tried that, and I get the following error...
> 
> Possible attempt to separate words with commas at C:\test.plx line
>  6.
> 'Start
> test',
> 'Stop
> test'

You should only get that warning if you used qw(), which Gary didn't.

   @arr = qw('foo bar', 'baz qux');   # incorrect; gives warning
   @arr = ('foo bar', 'baz qux');     # correct; assigns two elements

If your question is about using embedded whitespace in a qw list, you can't
do it, AFAIK.

> 
> I'm running Active State Perl 5.6 on Windows 2000 Pro.
> 
> -----Original Message-----
> From: Gary Stainburn [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 01, 2004 8:57 AM
> To: Meidling, Keith, CTR, ISD; [EMAIL PROTECTED]
> Subject: Re: Assigning elements to array (U)

Since you (like me) use Outlook, consider installing Outlook QuoteFix:

http://home.in.tum.de/~jain/software/outlook-quotefix/

> 
> 
> On Monday 01 March 2004 1:54 pm, Meidling, Keith, CTR, ISD wrote:
> > UNCLASSIFIED
> > 
> > How can I assign elements to an array that have spaces in them?
> > 
> > Say I have two elements that I want to put into an array, one is
> > 'Start test' the other is 'stop test'. The only way I know how to
> > do this is by the following. 
> > 
> > my @array;
> > 
> > $array[0]="Start test";
> > $array[1]="Stop test";
> > 
> > Is there an easier way?
> 
> Yup
> 
> my @array=('Start test','Stop test');

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to