in reply to Help Me in following code ::

rand only supplies a pseudo random number, you need to seed it using srand.

Replies are listed 'Best First'.
Re^2: Help Me in following code ::
by Anonymous Monk on Apr 12, 2010 at 12:28 UTC
    srand is needed only in versions of Perl before 5.004. I believe he might want to shuffle a deck of cards (ie there are only four aces, not an infinite supply).
Re^2: Help Me in following code ::
by dsheroh (Monsignor) on Apr 13, 2010 at 07:31 UTC
    -1, incorrect. From the rand docs you linked to:
    Automatically calls srand unless srand has already been called.
    There is no need to manually call srand in Perl.