第十五章:Perl模块

上一篇 / 下一篇  2008-11-12 11:42:29 / 个人分类:《Perl语言入门》-小骆驼书-练习题答案

1)
use warnings;
use Module::CoreList;
my %modules = %{ $Module::CoreList::version{5.006} };
print join "\n", keys %modules;

2)
use warnings;
use Cwd;
use File::Spec;
my $cwd = getcwd();
my @files = glob ".* *";
foreach my $file (@files){
 my $path = File::Spec->catfile($cwd, $file);
 print "$path\n"; 
}

3)
use warnings;
use Cwd;
use File::Spec;
use File::Basename;

my $cwd = getcwd;
my @files = glob ".* *";
foreach my $file(@files){
 my $path = File::Spec->catfile($cwd, $file); 
 my $basename = basename $path;
 print "$basename\n";
}


TAG:

 

评分:0

我来说两句

日历

« 2024-05-02  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

  • 访问量: 47914
  • 日志数: 80
  • 建立时间: 2008-10-27
  • 更新时间: 2009-07-17

RSS订阅

Open Toolbar