Also ich habe deine Subs 100000 durchlaufen lassen und es hat 5MB Arbeitspeicher gekostet:
for (1..100000){
$moonrise = dec2hour_minute($moonrise);
$moonset = dec2hour_minute($moonset);
$sunrise = dec2hour_minute($sunrise);
$sunset = dec2hour_minute($sunset);
printf "MA $moonrise, MU $moonset|SA $sunrise, SU $sunset";
}
edit:
selbst
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
for (1..100000){
my $date = Date::Indian->new(
ymd => sprintf("%s-%s-%s",$FORM{'year'},$FORM{'month'},$FORM{'day'}), # ex: ymd => '2003-10-31'
tz => sprintf("%s",dec2timezone($FORM{'tz'})), # ex: tz => '-5:30'
locn => sprintf("%sE %sN",$FORM{'lat'},$FORM{'long'}) # ex: locn =>'82:30E 17:25N'
);
my (@y, $m, $d, $t ) = $date -> ymd();
my ($moonrise, $moonset, $flag) = $date -> moonriseset();
my ($sunrise, $sunset, $flag) = $date -> sunriseset();
$moonrise = dec2hour_minute($moonrise);
$moonset = dec2hour_minute($moonset);
$sunrise = dec2hour_minute($sunrise);
$sunset = dec2hour_minute($sunset);
printf "MA $moonrise, MU $moonset|SA $sunrise, SU $sunset";
}
braucht nur rund 5mb, laeuft aber wesentlich laenger
Pörl.