Create array with range operator : range « Array « Perl






Create array with range operator

    

#!/usr/bin/perl

use warnings;
use strict;

my $max = 20;
my @array = (1..$max-1);

while (my $element = shift @array) {
    push (@array, $max - $element);
    sleep 1; 
    print '*' x $element, "\n"; 
}

   
    
    
    
  








Related examples in the same category

1.The List Separator Variable