Mohd Mohtashim has Published 238 Articles

What are Perl Scalars?

Mohd Mohtashim

Mohd Mohtashim

Updated on 28-Nov-2019 08:13:29

208 Views

A scalar is a single unit of data. That data might be an integer number, floating-point, a character, a string, a paragraph, or an entire web page.Here is a simple example of using scalar variables −Example Live Demo#!/usr/bin/perl $age = 25;                # An integer ... Read More

Perl Variable Context

Mohd Mohtashim

Mohd Mohtashim

Updated on 28-Nov-2019 08:11:25

494 Views

Perl treats the same variable differently based on Context, i.e., the situation where a variable is being used. Let's check the following example −Example Live Demo#!/usr/bin/perl @names = ('John Paul', 'Lisa', 'Kumar'); @copy = @names; $size = @names; print "Given names are : @copy"; print "Number of names are : ... Read More

Perl Hash Variables

Mohd Mohtashim

Mohd Mohtashim

Updated on 28-Nov-2019 08:08:19

316 Views

A hash is a set of key/value pairs. Hash variables are preceded by a percent (%) sign. To refer to a single element of a hash, you will use the hash variable name followed by the "key" associated with the value in curly brackets.Here is a simple example of using ... Read More

Perl Array Variables

Mohd Mohtashim

Mohd Mohtashim

Updated on 28-Nov-2019 08:05:52

265 Views

An array is a variable that stores an ordered list of scalar values. Array variables are preceded by an "at" (@) sign. To refer to a single element of an array, you will use the dollar sign ($) with the variable name followed by the index of the element in ... Read More

Perl Scalar Variables

Mohd Mohtashim

Mohd Mohtashim

Updated on 28-Nov-2019 08:03:30

228 Views

A scalar is a single unit of data. That data might be an integer number, floating-point, a character, a string, a paragraph, or an entire web page. Simply saying it could be anything, but only a single thing.Here is a simple example of using scalar variables −Example Live Demo#!/usr/bin/perl $age = ... Read More

Creating Variables in Perl

Mohd Mohtashim

Mohd Mohtashim

Updated on 28-Nov-2019 08:01:10

201 Views

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 ... Read More

What are Perl String Literals?

Mohd Mohtashim

Mohd Mohtashim

Updated on 28-Nov-2019 07:58:55

843 Views

Strings are sequences of characters. They are usually alphanumeric values delimited by either single (') or double (") quotes. They work much like UNIX shell quotes where you can use single-quoted strings and double-quoted strings.Double-quoted string literals allow variable interpolation, and single-quoted strings are not. There are certain characters when ... Read More

What are Perl Numerical Literals?

Mohd Mohtashim

Mohd Mohtashim

Updated on 28-Nov-2019 07:55:04

373 Views

Perl stores all the numbers internally as either signed integers or double-precision floating-point values. Numeric literals are specified in any of the following floating-point or integer formats −TypeValueInteger1234Negative integer-100Floating point2000Scientific notation16.12E14Hexadecimal0xffffOctal0577

What are different Perl Data Types?

Mohd Mohtashim

Mohd Mohtashim

Updated on 28-Nov-2019 07:51:52

299 Views

Perl is a loosely typed language and there is no need to specify a type for your data while using it in your program. The Perl interpreter will choose the type based on the context of the data itself.Perl has three basic data types: scalars, arrays of scalars, and hashes ... Read More

What is Perl Identifiers?

Mohd Mohtashim

Mohd Mohtashim

Updated on 28-Nov-2019 07:49:03

630 Views

Perl borrows syntax and concepts from many languages: awk, sed, C, Bourne Shell, Smalltalk, Lisp, and even English. However, there are some definite differences between the languages. This chapter is designed to quickly get you up to speed on the syntax that is expected in Perl.A Perl program consists of ... Read More

Advertisements