A scalar is a variable that stores a single unit of data at a time. The data that will be stored by the scalar variable can be of the different type like string, character, floating point, a large group of strings or it can be a webpage and so on.
Name = Alex Roll number = 13 Percentage = 87.65
Numeric scalar variables hold values like whole numbers, integers(positive and negative), float(containing decimal point). The following example demonstrates different types of numerical scalar variables in perl.
Positive Integer = 25 Negative Integer = -73 Floating Point = 23.5 Hexadecimal Form = 205
String scalar variables hold values like a word(made of different characters), a group of words or a paragraph. The following example demonstrates different types of string scalar variables.
String with alphabets = GeeksforGeeks String with numeric values = 17 String with alphanumeric values = gfg21 String within Single quotes = Hello Geeks String with special characters = ^gfg
- Perl | Comparing Scalars
- Perl Tutorial - Learn Perl With Examples
- Perl | Basic Syntax of a Perl Program
- Perl vs C/C++
- Perl | int() function
- Perl | last in loop
- Perl | each() Function
- Perl | given-when Statement
- Perl Hash
- Use of print() and say() in Perl
- Perl | GET vs POST in CGI
- Formats in Perl
- Perl | sin() Function
- Perl | cos() Function
- Perl | Modules
- Perl | Classes in OOP
- Perl | abs() function
- Perl | uc() Function
- Recursion in Perl
- Perl | qq operator
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.