473,395 Members | 1,931 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

GLOBAL Variables with qw()

Icecrack
174 Expert 100+
Thanks in Advance,

when declaring GLOBAL Variables can we use qw() ?

example:
Expand|Select|Wrap|Line Numbers
  1. my qw($data $id $test $var);
etc.


i will be testing this but if any one knows with in the next 1 hr please post
thanks

Thank You,

Charlie
Oct 3 '08 #1
6 7426
nithinpes
410 Expert 256MB
'my' is used to declare local variables. To declare multiple variables at once, you may use:
Expand|Select|Wrap|Line Numbers
  1. my ($data,$id,$test,$var); 
  2.  
qw() can be used only on RHS of any assignment statement, as in:
Expand|Select|Wrap|Line Numbers
  1. my @a = qw(ad sat d f g);
  2.  

-Nithin
Oct 3 '08 #2
Icecrack
174 Expert 100+
'my' is used to declare local variables.
Thank's i know that you may use:

Expand|Select|Wrap|Line Numbers
  1. use var qw($test $perl $var $etc);
Oct 3 '08 #3
NeoPa
32,556 Expert Mod 16PB
Charlie,

There seems to have been a little misunderstanding about what the Experts area is for.

Not a problem. I can move this thread for you, but technical questions still go in the relevant technical forum.

The Experts forum is for directing the attention of other experts to a tricky problem thread, or discussing issues related to the experts generally.
Oct 5 '08 #4
KevinADC
4,059 Expert 2GB
Thanks in Advance,

when declaring GLOBAL Variables can we use qw() ?

example:
Expand|Select|Wrap|Line Numbers
  1. my qw($data $id $test $var);
etc.


i will be testing this but if any one knows with in the next 1 hr please post
thanks

Thank You,

Charlie

If you look up qw in perl operators you will see it also does not interpolate variables. In other words, its the same as using single-quotes, so scalars will not be interpolated when used in a qw list.

Expand|Select|Wrap|Line Numbers
  1. $foo = 'test';
  2. my @list = qw($foo);
  3. print $list[0]; 
prints $foo
Oct 5 '08 #5
KevinADC
4,059 Expert 2GB
Thank's i know that you may use:

Expand|Select|Wrap|Line Numbers
  1. use var qw($test $perl $var $etc);
Yes that is OK, because it supplies a list to the vars pragma. Note that "vars" is obsolete but still supported.
Oct 5 '08 #6
Icecrack
174 Expert 100+
Yes that is OK, because it supplies a list to the vars pragma. Note that "vars" is obsolete but still supported.

Thank you all for your input,

Charlie
Oct 8 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Andrew V. Romero | last post by:
I have been working on a function which makes it easier for me to pull variables from the URL. So far I have: <script language="JavaScript"> var variablesInUrl; var vArray = new Array(); ...
17
by: MLH | last post by:
A97 Topic: If there is a way to preserve the values assigned to global variables when an untrapped runtime error occurs? I don't think there is, but I thought I'd ask. During development, I'm...
33
by: MLH | last post by:
I've read some posts indicating that having tons of GV's in an Access app is a bad idea. Personally, I love GVs and I use them (possibly abuse them) all the time for everything imaginable - have...
9
by: CDMAPoster | last post by:
About a year ago there was a thread about the use of global variables in A97: http://groups.google.com/group/comp.databases.ms-access/browse_frm/thread/fedc837a5aeb6157 Best Practices by Kang...
5
by: Sandman | last post by:
I dont think I understand them. I've read the section on scope in the manual inside out. I'm running PHP 5.2.0 Here is the code I'm working on: //include_me.php <?php $MYVAR = array(); global...
4
by: pcaisse | last post by:
I'm having issues sharing global variables with Explorer. This problem probably has a simple answer (as with most newbie questions). The script.pl file: #!/usr/bin/perl -w use strict; use...
1
weaknessforcats
by: weaknessforcats | last post by:
C++: The Case Against Global Variables Summary This article explores the negative ramifications of using global variables. The use of global variables is such a problem that C++ architects have...
8
by: rottmanj | last post by:
. In order to teach my self more. I have started to convert some of my cf scheduled tasks to perl applications. One area where things are kind of fuzzy is setting up global variables that can be...
4
Kelicula
by: Kelicula | last post by:
Hello all, I need to create a certain number of variables depending on a result set from a database. I only want to display 20 records per page, and I would like to have those page "markers" at...
112
by: istillshine | last post by:
When I control if I print messages, I usually use a global variable "int silent". When I set "-silent" flag in my command line parameters, I set silent = 1 in my main.c. I have many functions...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.