Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

This must be a simple mistake, but can someone correct
my @chars = ( A .. Z, a .. z, 1 .. 9, );
for me? It says there are bareword issues with "A", "Z", "a" and "z".

All I want to do is use all letters upper or lowercase and digits 0 - 9.

Replies are listed 'Best First'.
Re: Small range syntax error
by sleepingsquirrel (Chaplain) on Nov 09, 2004 at 19:58 UTC
    quotes...
    my @chars = ("A" .. "Z", "a" .. "z", 1 .. 9, );


    -- All code is 100% tested and functional unless otherwise noted.
      my @chars = ("A" .. "Z", "a" .. "z", 0 .. 9, );
Re: Small range syntax error
by graff (Chancellor) on Nov 10, 2004 at 02:25 UTC
    All I want to do is use all letters upper or lowercase and digits 0 - 9.

    Look, Ma! No quotes:

    my @chars = map { chr } (0x30..0x39,0x41..0x5a,0x61..0x7a);
      ... unless you're running on an EBCDIC system ;-)

      Dave.

Re: Small range syntax error
by TedPride (Priest) on Nov 09, 2004 at 21:15 UTC
    Oddly enough, it worked fine as is on MacPerl. But yes, you want to use "".
      It works with perl (Mac or otherwise) as long as use strict 'vars' isn't in effect. Bare words are considered treated as if quoted under no strict 'vars'.