Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

What is variable context in perl ?

user-image
Question added by Sameer Ahmed Z , Project Assitant , Indian Institute of Science
Date Posted: 2016/06/06
Mohammad kasid
by Mohammad kasid , ICT Engineer (Sr. Database Administrator) , Ericsson Global India Ltd.

Perl treats same variable differently based on Context, i.e., situation where a variable is being used. 

Assuming an array @my_array=("MOHD","KASID")

if I am storing this array in two different context. 

@my_newarray =@my_array;

$Lenght_array=@my_array;

print "@my_newarray and $Lenght_array"

so the final result will be : MOHD KASID and2

 

sreenivasa murthy Raju
by sreenivasa murthy Raju , Technical Lead , Saudi Telecom Company

Perl has three basic Variables types such as

1.Scalars

2.Arrays

3.Hashes

Scalars are single values: numbers, strings, and so on

There are three type of variable context available in perl

1. Boolean context

2. Void context

3. Interpolative context

More Questions Like This