i have 2 files A and B. From A, am trying to call a sub routine defined in B
code snippet A
verify($fh, 'host', 'state', 'testname');code snippet in B
sub verify { my $fh = shift; my $routes = 375000; my $inet0_total = 3436701; my $inet0_active = 498151; my $inet6_total = 115803; my $pass_count = 1; our $count_adj = 0; our $count_bfd = 0; our $tc_count = 1; ............... $tc_count = $tc_count + 1;
verify subroutine is called in file A at each testcase s, hence the tc_count should also be incremented. I defined tc_count as global using "our" hoping that tc_count will increment each time when the testcases are executed. But tc_count always shows as 1 for any testcases. Is there a way to retain the tc_count to its current value(after each increment), when the the subroutine verify is called from file A
here is the output after the execution for reference
.Testcase 1: Disable the process in the router
********************************************************** Verify ISIS adjacency(show isis adjacencies) ---------------------------------------- Interface System L State Hold (secs) SNPA ae1.0 paisa 2 Up 26Testcase 1: Enable the process in the router
********************************************************** Verify ISIS adjacency(show isis adjacencies) ---------------------------------------- Interface System L State Hold (secs) SNPA ae1.0 paisa 2 UpIn reply to Retain global value across files by Pavanai
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |