I saw a perl one liner to generate some random string of 8 chars:
perl -le 'print map { ("a".."z")[rand 26] } 1..5'
but this does not work without the {} for map. Why is that?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
See
perldoc -f map.maphas two forms:map({block} @array)andmap(expression, @array). The latter form can be used like so:The reason
doesn’t work is because it parses like
In other words,
"a".."z"become the only arguments ofmap, which is not valid. This can be disambiguated with an extra set of parentheses or with a unary+.