1831420 Members
3301 Online
110025 Solutions
New Discussion

Need script in perl

 
Swetha reddy
Occasional Contributor

Need script in perl

if (($x>=0) && ($x<=7)) // validating the xth column (0-7 values)
{
a++;
}
else
{
b++;
print $0 > "Error.txt" // redirects the failed rows
}
need to use the same code in perl ...in failed condition needs to disaply the row contents for teh failed one.
1 REPLY 1
H.Merijn Brand (procura
Honored Contributor

Re: Need script in perl

# Remark 1. // as comment is bad. Very bad (TM)

if (($x >= 0) && ($x <= 7)) { # validating the xth column (0-7 values)
$a++;
}
else {
$b++;
open ERR, ">> Error.txt" or die "Error.txt: $!";
print ERR; # redirects the failed rows
close ERR;
}

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn