Hi,
When trying to run my perl script to purge old data files I get this error. Since I am not very farmilar with Perl I really have no idea what is causeing this error and I can't get the debugger to work correctly to help me out either. Any ideas or suggestions?
(Note - Numbers are put in place with the {set nu} command in vi. They are not actually part of the script.)
syntax error at temp.pl line 31, near "else"
syntax error at temp.pl line 39, near "}"
SCRIPT
18 @Files = </dir/*/*>;
19
20 if (@Files eq </dir/save/*>) {
21
22 foreach $File (@Files){
23
24 if (-d $File){}
25
26 elsif (-M $file > 60){
27 unlink $File;
28
29 }else{}
30
31 else {foreach $File (@Files) {
32
33 if (-d $File){}
34
35 elsif (-M $File > 7){
36 unlink $File;
37
38 }else{}
39 } }
If I use the script this way it works fine. Why doesn't it work with the if statement?
@Files = </dir/*/*>;
foreach $File (@Files){
if (-d $File){}
elsif (-M $File > 7){
unlink $File;
}else{}
}
Thanks
When trying to run my perl script to purge old data files I get this error. Since I am not very farmilar with Perl I really have no idea what is causeing this error and I can't get the debugger to work correctly to help me out either. Any ideas or suggestions?
(Note - Numbers are put in place with the {set nu} command in vi. They are not actually part of the script.)
syntax error at temp.pl line 31, near "else"
syntax error at temp.pl line 39, near "}"
SCRIPT
18 @Files = </dir/*/*>;
19
20 if (@Files eq </dir/save/*>) {
21
22 foreach $File (@Files){
23
24 if (-d $File){}
25
26 elsif (-M $file > 60){
27 unlink $File;
28
29 }else{}
30
31 else {foreach $File (@Files) {
32
33 if (-d $File){}
34
35 elsif (-M $File > 7){
36 unlink $File;
37
38 }else{}
39 } }
If I use the script this way it works fine. Why doesn't it work with the if statement?
@Files = </dir/*/*>;
foreach $File (@Files){
if (-d $File){}
elsif (-M $File > 7){
unlink $File;
}else{}
}
Thanks