Forum Moderators: coopster & phranque

Message Too Old, No Replies

Comments in a "qw" array

can i add comments for each value in the array?

         

zigx

9:02 pm on Apr 2, 2004 (gmt 0)

10+ Year Member



this is sample array i have:

@prod_array_360 = qw(
23 #Product 1
235 #Product 2
435 #Product 3
4345 #Product 4
4t #Product 5
4t3 #Product 6
);

I want to leave comments in for othe rprogrammers...

is this possible?

VectorJ

3:42 am on Apr 3, 2004 (gmt 0)

10+ Year Member



No. qw acts as an operator and you can't include comments in the arguments to an operator. You could construct your array differently though, so that after you push a new value onto the array you leave a comment. Or just create a text file that lists the comments for each value and tell the other programmers where to find it.

coopster

4:12 pm on Apr 3, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



If you use quotes and commas you can document your code as you wish:
my @prod_array_360 = ( 
'23', #Product 1
'235', #Product 2
'435', #Product 3
'4345', #Product 4
'4t', #Product 5
'4t3' #Product 6
);