Perl Home
PERL Functions
© 2011 TutorialsPoint.COM
|
PERL unshift Function
Syntax
Definition and Usage
Places the elements from LIST, in order, at the beginning of ARRAY. This is opposite function to shift().
Return Value
Example
#!/usr/bin/perl -w
@array = ( 1, 2, 3, 4);
print "Value of array is @array\n" ;
unshift( @array, 20, 30, 40 );
print "Now value of array is @array\n" ;
|
It will produce following results:
Value of array is 1 2 3 4
Now value of array is 20 30 40 1 2 3 4
| |
|

|
|
|