It sounds to me like you want this, but i'm not really sure? if( (defined $afile) && !(defined $bfile) )
{
&parse_recent;
&parse_monthly;
&parse_new;
&create_temp_a;
©_new_to_recent;
©_recent_to_monthly;
&remove_excess;
&done;
} elsif( (defined $bfile) && !(defined $afile) )
{
&parse_recent;
&parse_monthly;
&parse_new;
&create_temp_a;
©_new_to_recent;
©_recent_to_monthly;
&remove_excess;
&done;
}
______________________________________________
|_____¸.·ooO--(> cRaZy is co01. <)--Ooo·.¸_____|
ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ | [reply] [d/l] |
if i have $afile, $bfile defined it does not proccess $bfile
damian: we don't have enough information here to tell you what's going on. On the surface, your code should work. Are you getting any error messages or is your code silently going along and doing stuff without complaining? If you're not getting error messages, I suggest four courses of action:
- Go over your subs and see if your setting any global vars that you use as conditionals. If so, the next time you encounter them, your subs may see them and not execute desired code.
- Read Using the Perl Debugger and try it out on your code. It's a bit more work up front, but I guarantee that the debugger will become one your best friends in the future.
- Verify the you are checking the return codes whenever you open or close a file. For example: open FILE, $file or die "Can't open $file: $!\n". That $! will hold your error code. If you don't check the return codes, you will have no idea whether or not your file manipulations worked.
- And for last, here's my guess as to your problem: I suspect for your code that if $bfile is defined that your sub such as &parse_recent and &parse_monthly are supposed to act on $bfile. However, it's not clear from your code how you are passing the appropriate file to the subs. Are they just acting on $afile all the time?
Hope this helps.
Cheers,
Ovid | [reply] |