+ -
当前位置:首页 → 问答吧 → perl 怎么调用子程序里的变量

perl 怎么调用子程序里的变量

时间:2010-09-06

来源:互联网

#!/usr/bin/perl -w
use strict;
our $WORK_DIR = $ARGV[0] . '/test';
our $SAVE_DIR = $ARGV[0] . '/saved';

&ReadDir($WORK_DIR);
if ( -d $SAVE_DIR/$part_path)
{
print $SAVE_DIR/$part_path;
}
else
{
  print "hehe";
}

sub ReadDir
{
   my ($dir) = @_;
   opendir(DIR, $dir);
   print $dir,"\n";
   foreach my $element (readdir(DIR))
  {
    my $full_path = "$dir/$element";
       
        if ('.' eq $element || '..' eq $element) { next; }
       
    print $full_path,"\n";
        print "1111111","\n";

    if (-d $full_path)
    {
          print "directory".$full_path,"\n";
      &ReadDir($full_path);
        }
    else
    {
     print "not directory","\n";
         print "full_path=",$full_path,"\n";
         my $partical_path = substr($full_path,29);
         print "partical_path=",$partical_path,"\n";
         our $part_path = substr($partical_path,0,rindex($partical_path,'/')+1);
         print "part_path=",$part_path,"\n";
         my $txtfile_dir = substr($full_path,0,rindex($full_path,'/')+1);
         print $txtfile_dir,"\n";
         my $call_unix = "cp $txtfile_dir/*.txt /ouc/oucdev/adm/ftp/cws/test2/";
         system($call_unix);

    }

  }
   closedir(DIR);
}

作者: zjm6533637   发布时间: 2010-09-06

回复 zjm6533637


    你的问题是啥!

作者: Perl_Er   发布时间: 2010-09-06

你想问什么?

作者: wfnh   发布时间: 2010-09-06

错了  我想问的是

我调用子程序  

怎么表示传进去的参数啊???

作者: zjm6533637   发布时间: 2010-09-06

就是怎么表示 第一个参数  第二个参数 第三个参数

作者: zjm6533637   发布时间: 2010-09-06