Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: Consecutive if loops

by Jim (Curate)
on Mar 18, 2013 at 16:35 UTC ( #1024103=note: print w/replies, xml ) Need Help??

in reply to Consecutive if loops

Describe what the script is supposed to do. It's not clear to me from briefly inspecting the code. I don't understand the intended logic.

Replies are listed 'Best First'.
Re^2: Consecutive if loops
by M15U (Acolyte) on Mar 18, 2013 at 16:51 UTC

    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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1024103]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2016-10-23 18:41 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (301 votes). Check out past polls.