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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2017-12-16 17:26 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (457 votes). Check out past polls.