[sf-perl] Thinking about psuedo-randomness

yary not.com at gmail.com
Mon Mar 30 20:27:16 PDT 2009


Thanks for putting the slides on-line, lots of interesting thoughts in there.

Since Randall chimed in with his bias of bias observation, I'll chime
in with what I thought when reading the scramble_case code-

@chars = split /(?=.)/, $string;

. doesn't match newlines (unless you tell it to), and it doesn't
matter, since nothing is lost anyways.

"I thought the canonical way of splitting a string into its component
chars was 'split //'" was my next thought.

Then I thought, "Only alphas have case, non-alphas don't have to be
separated out"- so

@chars = split /(?<=[[:alpha:]])/, $string;

could conceivably save a few cycles. maybe. It also preserves the
first-letter-case bias when the string begins with non-alpha chars.

and as you mentioned, it's how you wrote perl a decade ago.


More information about the SanFrancisco-pm mailing list