Update part of an array by referencing only a sub range
#!/usr/bin/perl -w
use strict;
my @sales = (169, 118, 197, 110, 103, 101, 108, 105, 76, 111, 118, 101);
my @months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
@sales[1..5] = (100, 101, 102, 103, 104);
print @sales
Related examples in the same category