![]() |
Hello,
I am trying to run a simple subroutine as part of a script, and I get the following error when I run the program. Global symbol "$arch_log_dir" requires explicit package name at ./chk_archive_lock.pl line 126. Execution of ./chk_archive_lock.pl aborted due to compilation errors. The code to the subroutine is below, and I would appreciate it if someone could show me where I am going wrong, as I am quite new to perl. I have tried putting a "my" infront of the variable name, but it doesn't seem to work... Thanks in advance, Cyber ------------------------------------------------ :
sub chk_arch_logs_create_time () {(You've been code tagged! ~ SykkN) |
your $arch_log_dir is being scoped inside your if{} blocks. If you want the variable to live through the entire subroutine you need to initiate it inside the sub{} block, but outside any other blocks{}.
:
sub chk_arch_logs_create_time () {was kind of a quick/dirty explantion. Please let me know if you need any clarification. |
No, thanks very much!
Your suggestion resolved my problem!! Cheers :) Cyber |
| All times are GMT -5. The time now is 3:32 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC