Says snax:
> I had no intention of calling you guilty
Oh, I didn't mean that. I meant that you were calling the code
guilty.
Anyway, I agree with you that the use of the
hash as an argument to map is a little weird,
and possibly obfuscated, because it's not clear
what is going to happen to the keys.
| [reply] |
Well, between your snippet and merlyn's,
and a CB comment by tye,
I've come to a much greater understanding of what's
going on. I think :)
If I'm understanding properly, you could do
anything to the keys in this setting, because
they're just strings and you can't get references to
them to allow their modification, which is how the
values get modified.
That's what my test code suggests, anyway:
#!/usr/local/bin/perl -w
use strict;
my $ref={ a => 'aa', b => 'bb'};
print "The hash, before:$/";
print %$ref;
print qq($/The hash "during":$/);
for (%$ref) {
/[A-Z]/ or $_ = 'x';
print;
}
print "$/The hash, after:$/";
print %$ref;
print $/;
__END__
The hash, before:
aaabbb
The hash "during":
xxxx
The hash, after:
axbx
This is perl, v5.6.0, BTW.
| [reply] [d/l] |