about summary refs log tree commit diff stats
path: root/ara.pl
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-06-05 20:43:51 +0530
committerAndinus <andinus@nand.sh>2020-06-05 20:43:51 +0530
commit68009b0312418aca6df486c2bb28a8f792b481c0 (patch)
tree1bc887cfb2b66bf72eb8339e9b2da5c7ddf14fef /ara.pl
parent9b59695181c37b34973448b2fe963bff803276dd (diff)
downloadara-68009b0312418aca6df486c2bb28a8f792b481c0.tar.gz
Merge if statements into a single block
Instead of checking if( $update_info eq "Today" ) three times, we
check it only once.
Diffstat (limited to 'ara.pl')
-rwxr-xr-xara.pl16
1 files changed, 7 insertions, 9 deletions
diff --git a/ara.pl b/ara.pl
index 015077c..0163064 100755
--- a/ara.pl
+++ b/ara.pl
@@ -111,18 +111,16 @@ foreach my $i (0...37) {
     $state = $statewise->[$i]{'statecode'} if
         length($state) > 16;
 
-    # Add delta only if it was updated Today.
     my $confirmed = "$statewise->[$i]{confirmed}";
-    $confirmed .= " (+$statewise->[$i]{deltaconfirmed})" if
-        $update_info eq "Today";
-
     my $recovered = "$statewise->[$i]{recovered}";
-    $recovered .= " (+$statewise->[$i]{deltarecovered})" if
-        $update_info eq "Today";
-
     my $deaths = "$statewise->[$i]{deaths}";
-    $deaths .= " (+$statewise->[$i]{deltadeaths})" if
-        $update_info eq "Today";
+
+    # Add delta only if it was updated Today.
+    if ( $update_info eq "Today" ) {
+        $confirmed .= " (+$statewise->[$i]{deltaconfirmed})";
+        $recovered .= " (+$statewise->[$i]{deltarecovered})";
+        $deaths .= " (+$statewise->[$i]{deltadeaths})";
+    }
 
     push @$rows, [
         $state,