Friday 15 November 2019

perl array - what is?

Perl Arrays:

Array is a collection of ordered elements, which is assigned by more than one elements like scalars,strings,numbers,floating points etc.

Creating Arrays:

Method 1:


@array=(8,1,3,-6,2);

print @array;



Method 2:


@array=('one',two,'five');

print @array;

Method 3:


@array =(0) x 10;

print @array;

Method 4:


@array = (1..10);

Method  5:


@array=qw(one two five);

Method 6:


@array=qw(one two five);

@new=@array;

Method 7:


push(@a,1..4);

print @a;

Method 8:


unshift(@b,1..4);

print @b;

Labels: ,

0 Comments:

Post a Comment

Note: only a member of this blog may post a comment.

<< Home