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

How can I modify the below code to work under strict?
my @chars = (a..z, A..Z, 0..9); my $URL = join '', map { @chars[rand @chars] } 1 .. 10; print $URL;
Thank you!

Replies are listed 'Best First'.
Re: Bareword "Z" not allowed while "strict subs" in use
by tobyink (Canon) on Nov 21, 2013 at 00:49 UTC
    my @chars = ('a'..'z', 'A'..'Z', 0..9);
    use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name
Re: Bareword "Z" not allowed while "strict subs" in use
by LanX (Saint) on Nov 21, 2013 at 00:50 UTC
    quote the characters, i.e 'a'..'z' and so on...

    Cheers Rolf

    ( addicted to the Perl Programming Language)

Re: Bareword "Z" not allowed while "strict subs" in use
by kcott (Archbishop) on Nov 21, 2013 at 00:53 UTC

    Use quotes:

    #!/usr/bin/env perl -l use strict; use warnings; my @chars = ('a'..'z', 'A'..'Z', 0..9); my $URL = join '', map { @chars[rand @chars] } 1 .. 10; print $URL;

    Output:

    ZfgLnUCDNQ

    -- Ken