in reply to SImulation of an Inventory.

"..What am I doing wrong?"
Several! Please, use use strict; you will catch some.

In your if statements you assign. I think what you intended was

if($diff == 'hard'){...}

You also have several barewords in your code..

Replies are listed 'Best First'.
Re^2: SImulation of an Inventory.
by Eliya (Vicar) on Jun 23, 2012 at 08:06 UTC
    if($diff == 'hard'){...}

    That isn't right either, because it does a numeric comparison.

    It should be

    if($diff eq 'hard'){...}

      Oops! Thanks Eliya for catching that, you are right !