Perl stands for Practical Extraction and Report Language. Perl is known as a high-level, interpreted, general-purpose and dynamic programming language. This blog/site is created to learn perl script and sort out most common problems in Perl programming. In this blog you can find out the solution of arrays, regex, regular expression, hashes, cpan modules, databases problems. Blog will contain the cool uses of Perl in future too.
Thnx for your comment, but pop is to remove the last element of array. No doubt $x contain the last element but it will also remove the last element from the array.
my @array=(1,2,3)
ReplyDelete$x=pop @array
print $x
Thnx for your comment, but pop is to remove the last element of array. No doubt $x contain the last element but it will also remove the last element from the array.
ReplyDeleteVery simple way..
ReplyDeletemy @array = (1,2,3);
print $array[-1]