
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Creating Variables in Perl
Perl variables do not have to be explicitly declared to reserve memory space. The declaration happens automatically when you assign a value to a variable. The equal sign (=) is used to assign values to variables.
Keep a note that this is mandatory to declare a variable before we use it if we use strict statement in our program.
The operand to the left of the = operator is the name of the variable, and the operand to the right of the = operator is the value stored in the variable. For example −
$age = 25; # An integer assignment $name = "John Paul"; # A string $salary = 1445.50; # A floating point
Here 25, "John Paul" and 1445.50 are the values assigned to $age, $name, and $salary variables, respectively. Shortly we will see how we can assign values to arrays and hashes.
Advertisements