#!/usr/bin/perl use strict; my @temps; foreach my $x (0..3) { $temps[$x] = &random_number; } printf("temp_sda:%s temp_sdb:%s temp_sdc:%s temp_sdd:%s\n", @temps); sub random_number { my $range = 100; my $random_number = int(rand($range)); return $random_number; }