perl - Can't find error "Global symbol @xx requires explicit package name" -


i have checked questions may have answer , none of them have helped.

this semester project unix programming. have created script compares html files 1 other website.

the script worked expected until tried implement second website, in turn deleted added code second website , errors

global symbol "@master" requires explicit package name global symbol "@child" requires explicit package name 

within csite_md5 subroutine. have gone through code many times on , cannot see problem.

i looking set of eyes see if i'm missing simple, case.

also new perl first time using language.

#!/usr/bin/perl  use strict; use warnings;  use digest::md5 qw(md5_hex); use file::basename;  # path c-site download root directory $csite_dir = '/root/websites/c-site/wget/';  opendir $dh, $csite_dir or die $!;  # finds sub directories c-site_'date +%f' c-site download located @wget_subdir_csite = sort grep /^[^.]/, readdir $dh;  # creates absolute path c-site download $csite_master_dir = "$csite_dir$wget_subdir_csite[0]/dayzunderground.webs.com"; $csite_child_dir = "$csite_dir$wget_subdir_csite[1]/dayzunderground.webs.com";  # call subroutine append .html file name absolute path @master_csite = &gethtml_master_csite($csite_master_dir); @child_csite = &gethtml_child_csite($csite_child_dir);  &csite_md5(\@master_csite, \@child_csite);  sub gethtml_master_csite{      ($master_path) = @_;     opendir (dir, $master_path) or die $!;      # ends .html , file     @html_master = sort grep {m/\.html$/i && -f "$master_path/$_"} readdir(dir);      @files_master = ("$master_path/$html_master[0]","$master_path/$html_master[1]","$master_path/$html_master[2]","$master_path/$html_master[3]");      return @files_master } sub gethtml_child_csite{      ($child_path) = @_;     opendir (dir, $child_path) or die $!;      # ends .html , file     @html_child = sort grep {m/\.html$/i && -f "$child_path/$_"} readdir(dir);      @files_child = ("$child_path/$html_child[0]","$child_path/$html_child[1]","$child_path/$html_child[2]","$child_path/$html_child[3]");      return @files_child }  sub csite_md5{      ($master, $child) = @_;      if(&md5sum($master[0]) ne &md5sum($child[0])){          $filename = basename($master[0]);         system("diff -u -d -t --width=100 $master[0] $child[0] > ~/websites/c-site/diff/c-site-$filename-`date +%f`");          #print "1"     }     if(&md5sum($master[1]) ne &md5sum($child[1])){          $filename2 = basename($master[1]);         system("diff -u -d -t --width=100 $master[1] $child[1] > ~/websites/c-site/diff/c-site-$filename2-`date +%f`");          #print "2"     }     if(&md5sum($master[2]) ne &md5sum($child[2])){          $filename3 = basename($master[2]);         system("diff -u -d -t --width=100 $master[2] $child[2] > ~/websites/c-site/diff/c-site-$filename3-`date +%f`");         #print "3"     }     if(&md5sum($master[3]) ne &md5sum($child[3])){          $filename4 = basename($master[3]);         system("diff -u -d -t --width=100 $master[3] $child[3] > ~/websites/c-site/diff/c-site-$filename4-`date +%f`");          #print "4"     } }  sub md5sum{     $file = shift;     $digest = "";     eval{         open(file, $file) or die "can't find file $file\n";         $ctx = digest::md5->new;         $ctx->addfile(*file);         $digest = $ctx->hexdigest;         close(file);     };     if($@){         print $@;         return "";     }     return $digest } 

$master , $child array references; use them $master->[0]. $master[0] uses array @master, separate variable.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -