in reply to Re^4: Using substr on Hash Keys
in thread Using substr on Hash Keys
I was replying to jettero who said "substr doesn't actually modify the string like splice modifies arrays" and there was no mention of hash keys in his post.
And actually, hash keys are strings, just not modifiable strings, but there is no error if you try to modify them:
$ perl -le' use warnings; use strict; my %x = qw/abcd efgh ijkl mnop/; substr $_, 0, 2, "" for %x; print for %x; ' ijkl op abcd gh
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Using substr on Hash Keys
by ikegami (Patriarch) on Sep 11, 2008 at 01:31 UTC |