Mohd Mohtashim has Published 185 Articles

Perl Operators Precedence

Mohd Mohtashim

Mohd Mohtashim

Updated on 29-Nov-2019 06:26:47

261 Views

The following table lists all operators from highest precedence to lowest in Perl Programming.

Perl Logical Operators

Mohd Mohtashim

Mohd Mohtashim

Updated on 29-Nov-2019 06:22:29

369 Views

There are following logical operators supported by Perl language. Assume variable $a holds true and variable $b holds false then −Sr.No.Operator & Description1andCalled Logical AND operator. If both the operands are true then the condition becomes true.Example− ($a and $b) is false. 2&&C-style Logical AND Operator copies a bit to the ... Read More

Perl Assignment Operators

Mohd Mohtashim

Mohd Mohtashim

Updated on 29-Nov-2019 06:15:04

296 Views

Assume variable $a holds 10 and variable $b holds 20, then below are the assignment operators available in Perl and their usage −Sr.No.Operator & Description1=Simple assignment operator, Assigns values from right side operands to left side operandExample−$c = $a + $b will assigned value of $a + $b into $c2+=Add ... Read More

Perl Equality Operators

Mohd Mohtashim

Mohd Mohtashim

Updated on 29-Nov-2019 06:12:47

562 Views

These are also called relational operators in Perl. Assume variable $a holds 10 and variable $b holds 20 then, let's check the following numeric equality operators available in Perl −Sr.No.Operator & Description1== (equal to)Checks if the value of two operands are equal or not, if yes then condition becomes true.Example− ... Read More

The Infinite Loop in Perl

Mohd Mohtashim

Mohd Mohtashim

Updated on 29-Nov-2019 06:06:58

2K+ Views

A loop becomes an infinite loop if a condition never becomes false. The for loop is traditionally used for this purpose. Since none of the three expressions that form the loop are required, in Perl, you can make an endless loop by leaving the conditional expression empty.#!/usr/local/bin/perl for( ; ; ... Read More

Loop Control Statements in Perl

Mohd Mohtashim

Mohd Mohtashim

Updated on 29-Nov-2019 06:05:21

2K+ Views

Loop control statements change the execution from its normal sequence. When execution leaves a scope, all automatic objects that were created in that scope are destroyed.Perl supports the following control statements. Click the following links to check their detail.Sr.No.Control Statement & Description1next statementIt causes the loop to skip the remainder ... Read More

The ? : Operator in Perl

Mohd Mohtashim

Mohd Mohtashim

Updated on 29-Nov-2019 06:01:59

529 Views

Let's check the conditional operator? : in Perl which can be used to replace if...else statements. It has the following general form −SyntaxExp1 ? Exp2 : Exp3;Where Exp1, Exp2, and Exp3 are expressions. Notice the use and placement of the colon.The value of a? expression is determined like this: Exp1 ... Read More

Add and Remove Elements in Perl Hashes

Mohd Mohtashim

Mohd Mohtashim

Updated on 29-Nov-2019 05:59:22

956 Views

Adding a new key/value pair in a Perl hash can be done with one line of code using a simple assignment operator. But to remove an element from the hash you need to use delete function as shown below in the example −Example Live Demo#!/usr/bin/perl %data = ('John Paul' => 45, ... Read More

Getting Hash Size in Perl

Mohd Mohtashim

Mohd Mohtashim

Updated on 29-Nov-2019 05:56:53

3K+ Views

You can get the size - that is, the number of elements from a hash in Perl by using the scalar context on either keys or values. Simply saying first you have to get an array of either the keys or values and then you can get the size of ... Read More

Checking for Key/Value Existence in Perl Hash

Mohd Mohtashim

Mohd Mohtashim

Updated on 29-Nov-2019 05:52:55

660 Views

If you try to access a key/value pair from a hash in Perl that doesn't exist, you'll normally get the undefined value, and if you have warnings switched on, then you'll get a warning generated at run time. You can get around this by using the exists function, which returns ... Read More

Advertisements