On Fri, Nov 14, 2003 at 04:30:05PM +0000, Douglas Houston wrote:
> On Fri, 14 Nov 2003, Jeff 'japhy' Pinyan wrote:
>> On Nov 14, Douglas Houston said:
>>
>>> I am trying to initialize a dynamically-named array
>>
>> You need to explain WHY you want to do this.  There doesn't seem to me to
>> be a good reason.  Use a hash of array references.  Don't turn off strict.
> 
> WHY do I need to explain why I want to do this? There certainly isn't a
> good reason to do it with the test code I posted.

Probably Jeff was being polite, giving you the benefit of the doubt,
allowing you to remain innocent-until-proven-guilty, etc.  The fact is,
there are very few good reasons to use symrefs -- exporting symbols is
the only one I can think of -- and if you have a good reason, you'll need
to give us some more information.

> If there's NEVER a good reason,

It's not that there's "NEVER" a good reason to use symbolic references.

It's just that the code you posted doesn't have one.  :-)

> what are the alternatives?

Use a hash of array references.  Instead of this:

    @$name = (1,2,3);    # gack!  what if $name is "_" or "INC"?

use this.

    $hash{$name} = [1,2,3];

>> And your "while (<$ARGV[0]>)" is weird, and not working why you think
>> it works.
>
> Can you
> 
> a) explain how I think it works, and

I don't know what you think the angle-brackets do here, but...
 
> b) explain why it really works.

Unless you think they do filename globbing, that code isn't working the
way you think it works.

-- 
Steve

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

Reply via email to