in reply to another question on a string of 20 letters

when i try from the cmdline

Yes, that's the definite way to decide such nagging questions.

For the q{a} x 20 . q{!} =~ m/^\w{6,20}$/ being true: This is a consequence of Perl's operator precedence. (See perldoc perlop.) Actually the return value of that command is a string of 20 'a'-s, since the dot in there has the lowest precedence. To the left of the dot we have 'a'x20 to which an empty string (the result of '!' not matching your regexp) is appended.

Replies are listed 'Best First'.
Re^2: another question on a string of 20 letters
by ikegami (Patriarch) on Feb 04, 2006 at 21:33 UTC

    More concisely,
    if (q{a} x 20 . q{!} =~ m/^\w{6,20}$/)
    means
    if ((q{a} x 20) . (q{!} =~ m/^\w{6,20}$/))
    (which is always true) and not
    if (((q{a} x 20) . q{!}) =~ m/^\w{6,20}$/)
    due to operator precedence.