diff options
author | James Raspass <jraspass@gmail.com> | 2022-01-25 11:04:22 +0000 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2022-02-17 17:47:57 -0700 |
commit | 56ceff59ef0980a5dc09b1aff0e3ba56607de0b4 (patch) | |
tree | f7b71928362b655cff470b84df98cfca7a82b491 /lib | |
parent | 861e73498e42732c5b82a6bdff709b6c6ae98965 (diff) | |
download | perl-56ceff59ef0980a5dc09b1aff0e3ba56607de0b4.tar.gz |
Tie::SubstrHash - Use ||= and //=
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Tie/SubstrHash.pm | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Tie/SubstrHash.pm b/lib/Tie/SubstrHash.pm index f0a9b2b5df..19947887af 100644 --- a/lib/Tie/SubstrHash.pm +++ b/lib/Tie/SubstrHash.pm @@ -93,13 +93,13 @@ sub STORE { if (ord($record) == 0) { $record = "\2". $key . $val; die "panic" unless length($record) == $rlen; - $writeoffset = $offset unless defined $writeoffset; + $writeoffset //= $offset; substr($$self[0], $writeoffset, $rlen) = $record; ++$$self[5]; return; } elsif (ord($record) == 1) { - $writeoffset = $offset unless defined $writeoffset; + $writeoffset //= $offset; } elsif (substr($record, 1, $klen) eq $key) { $record = "\2". $key . $val; @@ -163,7 +163,7 @@ sub hashkey { &_hashwrap if $hash >= 1e13; } &_hashwrap if $hash >= $tsize->[1]; - $hash = 1 unless $hash; + $hash ||= 1; $hashbase = $hash; } |