John W. Krahn wrote:
> Steve Bertrand wrote:

>> I wasted about two hours of my coding time trying to come up with a
>> special JAPH, but I just haven't been able to make map() do what I think
>> it should do ;)
> 
> What did you think it should do?  What did you want it to do?

Originally, I was trying to make map() generate a hash keyed from
strings that didn't exist (and I didn't know how to generate
dynamically), and push in values for those keys that could come from two
separate external hashes simultaneously.

Given that it's 0300 EST and I'm near Toronto, I'll review exactly what
I was after tomorrow, instead of trying to recall now ;)

>> +sub is_word ($) {
>> +    return unless defined $_[0] && $_[0] ne '';
>> +    return if $_[0] =~ /[\w\s]+/;
>> +    return 1;
>> +}
> 
> The other is_* functions in that module use anchors with their regular
> expressions so you probably should as well:
> 
> +    return if $_[0] =~ /^[\w\s]+$/;

Note that my sub (is_word) is the only one that has a return based on
if() and not unless()...

For some reason, I just couldn't wrap my head around the negative aspect
of 'unless' compared to the straight-forward 'if'. Twisting the
expression was easier for me than twisting the regex.

In my Real Life, I guess my mentality is stuck regarding 'unless' etc.
My mind would have me write out five lines of code, so long as those
lines didn't include 'unless'. I'm here to learn better ways however ;)


if ($life != $death) {
    have_sex_be_friendly();
} else {
    die "It was worth it (I love you Tracy!): $!";
}

Thanks John,

Steve

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to