zentara wrote:
> Hi,
> This one is puzzling me.
> I know it's in the faq, to not use variables for variable naming,
> but I find it odd that I can't get a "stringified" form of a variable
> name, maybe from the symbol table? Or from the B line of modules?
> 
> Say I have an array like:
> 
> @somename = (1,2,3,4,5);
> 
> and I want to write that array to a file, but I
> want the file named automatically by just
> dropping the @ off of the @somename.
> How would you go about doing it? Plus,
> I would like to be using strict.

I don't understand this part. Any techinique for accessing the "stringified"
form of the variable name would require using that very string as input no?
What do you need to do other than the following?

   my $filename = "somename.dat";

If the question is "How do I find the names of all the arrays in a
package?", then you probably shouldn't be using package variables for this.
Use a hash to hold those arrays instead.

> 
> Also the reverse: take a filename like "somename"
> and load it to an array @somename just by some
> concantation like @{'somename'}.
> 
> The @{'somename'} seems to work, but not with strict.

This is the thing the FAQ says not to do. Just don't do it. Use a hash.

Consider: what if the filename is "INC"? Do you want to trash @INC?

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

Reply via email to