Here is the algorithm i have used.
I have shown 3 perls A,B and C here.
The problem arises when 'I have a call to C.perl
At each step I have given the comments on wht i want to happen
################################
# Script A.perl
##################################
our @arrray;
sub Sub_prgA
{
If the array count is zero , then it is assumed this is the first call to sub_prgA
Then
{
load the array @array;
}
else
{
loop the array and do the operations
}
}
#End of A
################################
# Script B.perl
##################################
require"A"
#call sub routine of A in B
&Sub_prgA(); # array is loaded as this is the first call /* No issues here */
&Sub_prgA(); # this call does the operations on the array , set by the first call in B/* No issues here */
&Sub_prgA(); # this call does the operations on the array , set by the first call in B/* No issues here */
# Call other perl C in B
# problem starts here
System("C.perl");
# problem ends here
&Sub_prgA(); # this call does the operations on the array , set by the first call in B/* No issues here */
&Sub_prgA(); # this call does the operations on the array , set by the first call in B/* No issues here */
&Sub_prgA(); # this call does the operations on the array , set by the first call in B/* No issues here */
&Sub_prgA(); # this call does the operations on the array , set by the first call in B/* No issues here */
&Sub_prgA(); # this call does the operations on the array , set by the first call in B/* No issues here */
&Sub_prgA(); # this call does the operations on the array , set by the first call in B/* No issues here */
#End of B
################################
# Script C.perl
##################################
require"A"
#call sub routine of A in C
&Sub_prgA(); # RE-sets the , assuming that this the first call ************ This is where i have the problem .I dont want this step to load the arrray again ***
&Sub_prgA(); # this call does the operations on the array , set by the first call of C /* Problem , program should use the value set by B not C */
&Sub_prgA(); # this call does the operations on the array , set by the first call of C/* Problem , program should use the value set by B not C */
#End of C
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.