Chinaunix首页 | 论坛 | 博客
  • 博客访问: 836290
  • 博文数量: 253
  • 博客积分: 6891
  • 博客等级: 准将
  • 技术积分: 2502
  • 用 户 组: 普通用户
  • 注册时间: 2010-11-03 11:01
文章分类

全部博文(253)

文章存档

2016年(4)

2013年(3)

2012年(32)

2011年(184)

2010年(30)

分类: Python/Ruby

2011-10-13 21:55:41

we’ll get nothing but basename:
use File::Basename qw/ basename /;
And here, we’ll ask for no new functions at all:
use File::Basename qw/ /;
This is also frequently written as:
use File::Basename ();

Why would you want to do that? Well, this directive tells Perl to load  File::Base
name, just as before, but not to import any function names. Importing lets us use the
short, simple function names like basename and dirname. But even if we don’t import
those names, we can still use the functions. When they’re not imported, though, we
have to call them by their full names:
use File::Basename qw/ /;                     # import no function names
my $betty = &dirname($wilma);                 # uses our own subroutine &dirname
                                                   #(not shown)
my $name = "/usr/local/bin/perl";
my $dirname = File::Basename::dirname $name;  # dirname from the module


阅读(611) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~