- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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.
- Related Articles
- Creating Hashes in Perl
- Perl Scalar Variables
- Perl Array Variables
- Perl Hash Variables
- Filehandle Special Variables in Perl
- Perl CGI Environment Variables
- State Variables via state() in Perl
- Regular Expression Special Variables in Perl
- Creating and Using Objects using Perl
- Private Variables in a Subroutine in Perl
- Creating Variables using Pre Request Script using Postman?
- Comments in Perl
- Whitespaces in Perl
- Dereferencing in Perl
- "Here" Documents in Perl

Advertisements