Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2017-02-19 16:02 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (292 votes). Check out past polls.