Greetings;
I can get qw to work for things like
@n = qw( john jacob jingleheimer schmidt );
but something like
@n = qw( $names );
doesn't work. I get the literal string "$names" in @n!
What does the equivalent of qw(???) for a variable?
Many TIA!
Dennis
--
To unsubscribe,
perlop
or perldoc perlop
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 19, 2002 2:39 PM
To: [EMAIL PROTECTED]
Subject: qw for variables?
Greetings;
I can get qw to work for things like
@n = qw( john jacob jingleheimer schmidt
> What does the equivalent of qw(???) for a variable?
You mean like:
my @array = ($var1, $var2, $var3);
Jonathan Paton
__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.
is
>}On Feb 19, 17:47, "=?iso-8859-1?q?Jonathan=20E.=20Paton?=" wrote:
>} Subject: Re: qw for variables?
>> What does the equivalent of qw(???) for a variable?
>
>You mean like:
>
>my @array = ($var1, $var2, $var3);
>
>Jonathan Paton
>
>___
On Feb 19, Dennis G. Wicks said:
>No, I mean if $names contains "Jesus Mary Joseph" and I do
>
> my @n = qw( $names );
>
>I want the same results as if I had done
>
> my @n = qw( Jesus Mary Joseph );
There's no quoting operator that will do that for you. I'd suggest using
split().
you want split then..
my $names = "Jesus Mary Joseph";
my @n = split /\s+/, $names;
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 19, 2002 3:08 PM
To: [EMAIL PROTECTED]
Subject: Re: qw for variables?
Greetings;
No, I mean
Dennis G. Wicks wrote:
>Greetings;
>
>No, I mean if $names contains "Jesus Mary Joseph" and I do
>
> my @n = qw( $names );
>
>I want the same results as if I had done
>
> my @n = qw( Jesus Mary Joseph );
>
>Obviously qw() does not work this way, but I can't find the
>equivalent that d
The split did the trick, and cut out a few lines of code
also. I had already done some splits and joins to get ready
for qw() which I can n ow delete!
Thanks for the help everyone!
Dennis
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
In article <[EMAIL PROTECTED]> wrote "Dennis G. Wicks" <[EMAIL PROTECTED]>:
> Greetings;
>
> I can get qw to work for things like
>
> @n = qw( john jacob jingleheimer schmidt );
>
> but something like
>
> @n = qw( $names );
>
> doesn't work. I get the literal string "$names"