Thanks for your reply. this version of code looks better, but now, I suspect i am on the right way. In order to avoid exposing variables in global, I have to pass 5 paras to cell_work function. and as a module, $callback_data does confuse end user.
to my primitive intention, I just want to separate code into subs and modules for managing. But it now seems to raise complexity of code. do I have to come back to below tedious code?
# main, use below to substitute cell_walk and callback routine
for ( my $row = 1 ; $row <= $LastRow ; $row++ ) {
for ( my $col = 1 ; $col <= $LastCol ; $col++ ) {
next if !defined $Sheet->Cells( $row, $col )->{Value};
if ( $Sheet->Cells( $row, $col )->{Value} =~ /^~~~/ ) {
my @a =
split( /__/, substr( $Sheet->Cells( $row, $col )->{Value
+}, 3 ) ); #grab useful string
if( scalar @a == 3){
$Sheet->Cells( $row, $col )->{Value} =
$hl->get_single_LP( 'ADAS_VAL_RAW', @a );
}
if( scalar @a == 4){
$Sheet->Cells( $row, $col )->{Value} =
$hl->accu_LP( 'ADAS_VAL_NORM', @a );
}
}
}
}
I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.