Click here to Skip to main content
15,894,291 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi ,

Please can anyone help me in converting perl code to C#.
I am not from perl background.

PERL
#!/usr/bin/perl
 
my $csv   = "$ARGV[0]";
$filename = $csv;
$filename =~ s/.csv//;

open(Data,"$csv");
 
open(testlist, "testlist.txt"); 

while (<testlist>) 
{
push (@testlist,$_);
}

$TotalTest = @testlist;

close (testlist) || die "Couldn't close file properly";

open(summary, ">../$csv"); 
print summary "Test,PassCount,FailCount\n";


foreach $test (@testlist) {
chomp $test;
open(passfailtest,"$csv"); 
$pass_count = 0; 
$fail_count = 0;
	while (<passfailtest>)
	{
		if ($_ =~ /\b$test\b/)	
		{
			#print "$_";
			if ($_ =~ /Pass/)	
			{
				$pass_count ++;
			}

		if ($_ =~ /Fail/)	
			{
				$fail_count ++;
			}
	
		}

	}	
print summary "$test,$pass_count,$fail_count\n";
}


Thanks
sanju

What I have tried:

I am trying to understand the code from perl script.
But getting difficulties in converting perl code to c#.
Posted
Updated 21-Aug-16 2:00am
Comments
Mehdi Gholam 21-Aug-16 7:22am    
Try by seeing what the input is and what you get when you run the code and working from there.

(Perl is usually write-once code!)

1 solution

hello
use telerik convert
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900