To complete previous posts, have a look to this:

Subject:      Why it's stupid to `use a variable as a variable name'
http://perl.plover.com/varvarname.html

José.

-----Original Message-----
From: Douglas Houston [mailto:[EMAIL PROTECTED] 
Sent: Friday, November 14, 2003 4:55 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: How do you dynamically assign array names?


Hi,

I am trying to initialize a dynamically-named array, i.e. with the following test code 
(if I type "script.pl char" at the command prompt) I get the message "array char 
contains 1 2 3" but I get a warning if 'use strict' is on. Can anyone show me how it 
should be done (I would like to use 'use strict'!)?

#!/usr/bin/perl -w
#use strict;
my ($string);

while (<$ARGV[0]>) {
  chomp($string=$_);
  @$string = (1,2,3);  #Won't work if 'use strict' pragma is used }

print "array $string contains @$string\n";


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



**** DISCLAIMER ****

"This e-mail and any attachment thereto may contain information which is confidential 
and/or protected by intellectual property rights and are intended for the sole use of 
the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, total or 
partial reproduction, communication or distribution in any form) by other persons than 
the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either by 
telephone or by e-mail and delete the material from any computer".

Thank you for your cooperation.

For further information about Proximus mobile phone services please see our website at 
http://www.proximus.be or refer to any Proximus agent.


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to