- 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
Perl Numeric Scalars
A scalar is most often either a number or a string. Following example demonstrates the usage of various types of numeric scalars −
Example
#!/usr/bin/perl $integer = 200; $negative = -300; $floating = 200.340; $bigfloat = -1.2E-23; # 377 octal, same as 255 decimal $octal = 0377; # FF hex, also 255 decimal $hexa = 0xff; print "integer = $integer\n"; print "negative = $negative\n"; print "floating = $floating\n"; print "bigfloat = $bigfloat\n"; print "octal = $octal\n"; print "hexa = $hexa\n";
Output
This will produce the following result −
integer = 200 negative = -300 floating = 200.34 bigfloat = -1.2e-23 octal = 255 hexa = 255
- Related Articles
- Perl String Scalars
- What are Perl Scalars?
- Scalars and Vectors
- How to check if a variable has a numeric value in Perl?
- Write down the difference between Scalars and Vectors?
- C# Numeric Promotion
- Python Numeric Types
- Perl First Program
- Perl File Extension
- Comments in Perl
- Whitespaces in Perl
- Perl Scalar Variables
- Perl Array Variables
- Perl Hash Variables
- Perl Variable Context

Advertisements