in reply to Subroutine does not sleep

my $time =@_;

You're evaluating the array, @_, in scalar context. So you get the number of elements. Try using this instead:

my ($time) = @_;
--
<http://dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg