Powered by Ajaxy
Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Perl: add value to array at specified index

Perl: add value to array at specified index
{filelink=14089}

#!/usr/bin/perl
# define an array
@tab = ("January", "March", "May");
# print array values
print "@tab";
# set value at index 1
$tab[1]="February";
# print array values
print<span id="more-43"></span> "@tab";
# get value at index 2
print "$tab[2]n";
# add item at index 3
$tab[3]="June";
print "$tab[3]n";

No comments yet.

Leave a Comment