Write a Perl program that performs the following tasks:
- Generate a menu to ask the user for the task that he or she would like to see performed.
- The available tasks are as follows:
- Show current date and time.
- Show users currently logged in.
- Show the name of the working directory.
- Show the contents of the working directory.
- Prompt the user for the choice, and perform the system command.
Also, describe how variables in Perl are handled, specifically with respect to the need for declaration and type casting.