# sub: find block (in cols), return line-numbers (begin-end) or 0 if notfound
sub findb{
my ($exp1,$col1,$exp2,$col2)= @_; # $exp = expression to find, $col - column to search in
my $cnt=0;
my ($val1,$val2);
my ($beg,$end);
for($cnt=1;$cnt<=65536;$cnt++){
$val1 = $Excel->Cells($cnt,$col1)->{'Value'};
$val2 = $Excel->Cells($cnt,$col2)->{'Value'};
if ((defined $val1)&&(index($val1,$exp1) != -1)&&(defined $val2)&&(index($val2,$exp2) != -1)){
$beg =$cnt if (!defined $beg);
}
else{
if (defined $beg){
$end =$cnt-1;
last;
}
}
}
return ($beg,$end);
}
Can anyone please help me out how this function works.....
I am not getting what is the meaning of value over here
Hi,
Just go through the Spreadsheet::ParseExcel.
Value - You will get value of that cell [row_inex][col_inedx] of that excel sheet.
Edit by pludi: if you continue to forgo our rules on post formatting, you'll be set to a read-only status for at least 1 month. Consider this your final warning
Hallo Pravin,
thanks for your reply...
I have some paramters like this:
# Parameters
my $partname = $ARGV[0];
my $csvfile = $ARGV[1];
my $xlfile = $ARGV[2];
my $adatafile = $ARGV[3];
my $outfile = $ARGV[4];
so will you please tell me what partname will contain.....
What is the value of argv[0].............
and i am passing this value to findb() function..........
findb("OUTPUT_DATA",2,$partname,3);
Please give me a clear idea about partname
Hi,
When you are passing any argument at command line to perl script, it will be store in @ARGV array(built in).So your first argument will be store in ARGV[0] and second in ARGV[1] and so on.
~ Pravin ~