Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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.


Comment on Re: Consecutive if loops
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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (18)
As of 2014-08-27 13:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (238 votes), past polls