in reply to Re: Consecutive if loops
in thread Consecutive if loops
I actually got it by experimenting with the code. I wanted to give a user different levels of control. The goal was to display the content of the second and the third between two dates. And the user could choose to input, the year, the month, the day, the hour or all of them.
I just had to add "^" and "$" in the first regex in order to mark the beginning and the end of the string :
elsif ($start_input =~ /^\d\d\d\d\.\d\d\.\d\d\.\d\d$/ && $end_input =~ + /^\d\d\d\d\.\d\d\.\d\d\.\d\d$/){ $start_input =~ tr/\.//d; print "$start_input\n"; $end_input =~ tr/\.//d; print "$end_input\n"; while (<DATA>){ if (/$start_input/ .. /$end_input/){ if ($_ =~ /(.*)\t(.*)\t(.*)/){ print "Date = $1" . "\t" . "Temp_moy_DegCs = $2" . "\ +t" . "HR_moy_s = $3\n"; } } } }
it seems to work now.
|
|---|