Articles on Trending Technologies

Technical articles with clear explanations and examples

Create References in Perl

Mohd Mohtashim
Mohd Mohtashim
Updated on 29-Nov-2019 229 Views

A Perl reference is a scalar data type that holds the location of another value which could be scalar, arrays, or hashes. Because of its scalar nature, a reference can be used anywhere, a scalar can be used.It is easy to create a reference for any variable, subroutine or value by prefixing it with a backslash as follows −$scalarref = \$foo; $arrayref = \@ARGV; $hashref = \%ENV; $coderef = \&handler; $globref = \*foo;You cannot create a reference on an I/O handle (filehandle or dirhandle) using the backslash operator but a reference to an anonymous array can be created using the ...

Read More

Subroutine Call Context in Perl

Mohd Mohtashim
Mohd Mohtashim
Updated on 29-Nov-2019 326 Views

The context of a Perl subroutine or statement is defined as the type of return value that is expected. This allows you to use a single function that returns different values based on what the user is expecting to receive. For example, the following localtime() returns a string when it is called in scalar context, but it returns a list when it is called in list context.my $datestring = localtime( time );In this example, the value of $timestr is now a string made up of the current date and time, for example, Thu Nov 30 15:21:33 2000. Conversely −($sec, $min, ...

Read More

Perl Operators Precedence

Mohd Mohtashim
Mohd Mohtashim
Updated on 29-Nov-2019 265 Views

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

Read More

Perl Logical Operators

Mohd Mohtashim
Mohd Mohtashim
Updated on 29-Nov-2019 374 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 result if it exists in both operandsExample− ($a && $b) is false.3orCalled Logical OR Operator. If any of the two operands are non zero then condition becomes true.Example− ($a or $b) is true.4||C-style Logical OR Operator copies a bit if it exists in either operand.p>Example− ($a || $b) is true.5notCalled ...

Read More

Perl Assignment Operators

Mohd Mohtashim
Mohd Mohtashim
Updated on 29-Nov-2019 300 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 AND assignment operator, It adds right operand to the left operand and assign the result to left operandExample−$c += $a is equivalent to $c = $c + $a.3-=Subtract AND assignment operator, It subtracts right operand from the left operand and assigns the result to left operandExample−$c -= $a is equivalent ...

Read More

Perl Equality Operators

Mohd Mohtashim
Mohd Mohtashim
Updated on 29-Nov-2019 564 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− ($a == $b) is not true.2!= (not equal to)Checks if the value of two operands are equal or not, if values are not equal then the condition becomes true.Example− ($a != $b) is true.3Checks if the value of two operands are equal or not, and returns -1, 0, or 1 ...

Read More

The Infinite Loop in Perl

Mohd Mohtashim
Mohd Mohtashim
Updated on 29-Nov-2019 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( ; ; ) {    printf "This loop will run forever."; }You can terminate the above infinite loop by pressing the Ctrl + C keys.When the conditional expression is absent, it is assumed to be true. You may have an initialization and increment expression, but as a programmer more commonly use the ...

Read More

Loop Control Statements in Perl

Mohd Mohtashim
Mohd Mohtashim
Updated on 29-Nov-2019 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 of its body and immediately retest its condition prior to reiterating.2last statementTerminates the loop statement and transfers execution to the statement immediately following the loop.3continue statementA continue BLOCK, it is always executed just before the conditional is about to be evaluated again.4redo statementThe redo command restarts the loop block without ...

Read More

Creating Hashes in Perl

Mohd Mohtashim
Mohd Mohtashim
Updated on 29-Nov-2019 232 Views

Perl Hashes are created in one of the two following ways. In the first method, you assign a value to a named key on a one-by-one basis −$data{'John Paul'} = 45; $data{'Lisa'} = 30; $data{'Kumar'} = 40;In the second case, you use a list, which is converted by taking individual pairs from the list: the first element of the pair is used as the key, and the second, as the value. For example −%data = ('John Paul', 45, 'Lisa', 30, 'Kumar', 40);For clarity, you can use => as an alias for, to indicate the key/value pairs as follows −%data = ...

Read More

Difference between Frontend Testing and Backend Testing

Mahesh Parahar
Mahesh Parahar
Updated on 28-Nov-2019 720 Views

A Web based application is generally three tier architecture based application. First layer is presentation layer called front-end, second layer is business layer or application layer and third layer is database called back-end.Frontend TestingFrontend testing refers to testing the application UI or presentation layer. It can be manual as well as automated.Backend TestingBackend testing refers to testing the backend and application layers. It is normally automated.Following are the important differences between Frontend Testing and Backend Testing.Sr. No.KeyFrontend TestingBackend Testing1LayerFrontend testing is performed on Presentation Layer.Backend testing is performed on Application and Database layer.2GUIIn Cloud Computing, resources are centrally managed.In Grid ...

Read More
Showing 54451–54460 of 61,248 articles
Advertisements