on Sat, 13 Jul 2002 10:42:23 GMT, Connie Chan wrote:

> But what I most consider is that, if I use numeric format as hash
> key will cause any error. As long as other programming langs I
> learnt, I know var name should not in numeric format, but the 
> grey zone for me in this case is that I can treat the key as string 
> too... so maybe no problem... I don't know...

There is no problem whatsoever in using hash keys which are numbers.
The only thing to watch out for is the autoquoting feature of the '=>' 
operator and between the '{}' hash delimiters, which only work if the 
token on the left of '=>' or between '{}' has the form of a Perl  
identifier. 

E.g.

        %hash = ( abc => 'xyz');
        $hash{abc} = 'xyz;;

will work, but

        %hash = (0123 => 'xyz');
     $hash{0123} = 'xyz';

will not. However,

        %hash = ('0123' => 'xyz');
     $hash{'0123'} = 'xyz';

will always work.

-- 
felix

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

Reply via email to