$foo{shift} is the same as $foo{'shift'} - you want $foo{(shift)}. This is what's causing your overwriting problem - everything is indexed under $whatever{'shift'}.
Just wanted to say that the standard way of doing this is not to parethesize the shift, but to put a + in front of it. This is perls way of ensuring that whatever follows the plus is construed as code and not something else. Note that this is NOT the same as 0+shift, which coerces numeric context.
This is IME particularly useful with print and with hash keys.
print +($.>10) ? "Skipped." : "Ok";
$foo{+shift}=10;
--- demerphq
my friends call me, usually because I'm late....