If condition based look shows the wrong results [closed]
I want to look up a range and return group id and thought a simple if based lookup would work. But, it is not working. I am not sure why. #!/usr/bin/perl sub get_xid { my $x_id = ""; if(($_[0] ge 1) && ($_[0] le 4)) { $x_id = "x.1"; } if(($_[0] ge 5) && ($_[0] le 8)) { $x_id = "x.2"; } if(($_[0] ge 9) && ($_[0] le 12)) { $x_id = "x.3"; } if(($_[0] ge 13) && ($_[0] le 16)) { $x_id = "x.4"; } if(($_[0] ge 17) && ($_[0] le 20)) { $x_id = "x.5"; } if(($_[0] ge 21) && ($_[0] le 24)) { $x_id = "x.6"; } if(($_[0] ge 25) && ($_[0] le 28)) { $x_id = "x.7"; } if(($_[0] ge 29) && ($_[0] le 32)) { $x_id =
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.