Dynamically populating array elements in an array respective to it's index position.
#!/usr/bin/perl my @arr; for (my $i = 0; $i < 55; $i++) { $arr[$i] = 'I am element number '.$i; } print "Value at Index 0 of Array = ".$arr[0]."\n"; print "Value at Index 1 of Array = ".$arr[1]."\n"; print "Value at Index 2 of Array = ".$arr[2]."\n"; print "Value at Index 3 of Array = ".$arr[3]."\n"; print "Value at Index 4 of Array = ".$arr[4]."\n";
Output: ------- Value at Index 0 of Array = I am element number 0 Value at Index 1 of Array = I am element number 1 Value at Index 2 of Array = I am element number 2 Value at Index 3 of Array = I am element number 3 Value at Index 4 of Array = I am element number 4
AllBlogToolsFacebook comments for blogger brought to you by AllBlogTools.com , Get Yours?