qw for variables?
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, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: qw for variables?
qw( john jacob $name ) is equivelent to ('john', 'jacob', '$name') notice the single quote. The single quotes does not interpolate (use the special meanings of special charaters, so the $ doesn't designate a varible name it's just a $ character). see man 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 ); 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, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: qw for variables?
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.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: qw for variables?
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 does. Thanks, Dennis }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 __ 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.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] }-- End of excerpt from =?iso-8859-1?q?Jonathan=20E.=20Paton?= -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: qw for variables?
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 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 does. Thanks, Dennis }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 __ 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.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] }-- End of excerpt from =?iso-8859-1?q?Jonathan=20E.=20Paton?= -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: qw for variables?
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 does. Thanks, Dennis How about: my @n = split(/\s+/, $names); - Johnathan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: qw for variables?
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]
Re: qw for variables?
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 in @n! What does the equivalent of qw(???) for a variable? Do you mean that $names contains the string john jacob jingleheimer schmidt Then split is your friend: @n = split / /, $names; Greetings, Andrea -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]