foreach(@sites){ $site=$_; # call the sub &getpages($site); }