L
lerameur
Hello,
I used the switching command CASE in c++
Is there such a thing in perl.? I did not find the command from
googling with perl.
the reason for this is I am trying to increment a time. Maybe there is
a way around it. Here is the part of the program I have:
Goal: there are many log files per hour. The program should put it to
one file, starting from the user input date. The problem is getting
the roller over date.
$year2= 07; #type in the year
$month2= 09; #type in the month
$day2= 05; #type in the day
$hours2 = 04; #type in the hour
$logTime = $year$month$day$hours; # date to begin search
$minutes_count = 0; #Put to zero every time it will go throw the loop
to gather all log files within that hour
if($minutes_count<10) {
$minutes_count="0$minutes_count";
} else {
$minutes_count=$minutes_count; #Calculate
Minutes_count for double digit
}
$logTimeIncrement = $logTime$minutes_count"*";
while ($minutes_count != 60){ # This loop goes through every minute
for that our and append the new found log to the main hour log
if ($logTimeIncrement == true){
open (log_$logTime, >>log_$logTime) ||
die ("Cannot open input file $logTimeIncrement \n") ; # this file is
the accumulator file
open (File, >>$logTimeIncrement) ||
die ("Cannot open input file $logTimeIncrement \n") ;
$doc1 = <log_$logTime>;
$doc2 = <File>;
while ($doc1 ne " " || $doc2 ne " "){
if ($doc1 ne " ") {
print ($doc1);
$doc1 = <log_$logTime>>;
}
if ($doc2 ne " "){
print ($doc2);
$doc2 = <File>;
}
} #end of while loop
}
$minutes_count++;
if($minutes_count<10) {
$minutes_count="0$minutes_count";
} else {
$minutes_count=$minutes_count;
}
# Checking the roller over dates
if ($minutes_count ==60){
$hours2++;
$minutes_count=0;
}
if ($hours2==24){
$day2++;
$hours2=0;
}
I stopped here since I decided to look for case equivalent.
I used the switching command CASE in c++
Is there such a thing in perl.? I did not find the command from
googling with perl.
the reason for this is I am trying to increment a time. Maybe there is
a way around it. Here is the part of the program I have:
Goal: there are many log files per hour. The program should put it to
one file, starting from the user input date. The problem is getting
the roller over date.
$year2= 07; #type in the year
$month2= 09; #type in the month
$day2= 05; #type in the day
$hours2 = 04; #type in the hour
$logTime = $year$month$day$hours; # date to begin search
$minutes_count = 0; #Put to zero every time it will go throw the loop
to gather all log files within that hour
if($minutes_count<10) {
$minutes_count="0$minutes_count";
} else {
$minutes_count=$minutes_count; #Calculate
Minutes_count for double digit
}
$logTimeIncrement = $logTime$minutes_count"*";
while ($minutes_count != 60){ # This loop goes through every minute
for that our and append the new found log to the main hour log
if ($logTimeIncrement == true){
open (log_$logTime, >>log_$logTime) ||
die ("Cannot open input file $logTimeIncrement \n") ; # this file is
the accumulator file
open (File, >>$logTimeIncrement) ||
die ("Cannot open input file $logTimeIncrement \n") ;
$doc1 = <log_$logTime>;
$doc2 = <File>;
while ($doc1 ne " " || $doc2 ne " "){
if ($doc1 ne " ") {
print ($doc1);
$doc1 = <log_$logTime>>;
}
if ($doc2 ne " "){
print ($doc2);
$doc2 = <File>;
}
} #end of while loop
}
$minutes_count++;
if($minutes_count<10) {
$minutes_count="0$minutes_count";
} else {
$minutes_count=$minutes_count;
}
# Checking the roller over dates
if ($minutes_count ==60){
$hours2++;
$minutes_count=0;
}
if ($hours2==24){
$day2++;
$hours2=0;
}
I stopped here since I decided to look for case equivalent.