in reply to fork(): where does copy happen?

Technically if you want to see if the hashref $hash has an element for key $var you want exists. Even so neither of those two examples should force a copy of %{$hash} (at least I don't believe so; however if there were multiple levels there such that you trigger autovivification (i.e. $hash->{'not there'}->{$var}) it would probably force a copy since you're implicitly changing $hash's contents). And if you really want read-only then Readonly will make it enforced not just by convention.

You might also want to consider using something like BerkelyDB or DBD::SQLite to access your data from disk rather than pulling it all into RAM.

Update: Or Cache::Memcache might be worth looking into as well.

Update: Duur, Readonly not ReadOnly. Thanks to superfrink for the catch.

The cake is a lie.
The cake is a lie.
The cake is a lie.

Replies are listed 'Best First'.
Re^2: fork(): where does copy happen?
by perrin (Chancellor) on Apr 16, 2008 at 13:15 UTC
    Of those, BerkeleyDB is by far the fastest. SQLite does has the advantage of full SQL queries though.