in reply to Time command output is not stored into the variable.

What error? A usage error like the following?

Usage: time [-apvV] [-f format] [-o file] [--append] [--verbose] [--portability] [--format=format] [--output=file] [--version] [--quiet] [--help] command [arg...]

The program needs an argument, a command to time. This has nothing to do with Perl.