Perl Tips and Best Practices

- Get the absolute path and extract the basename. 

use Cwd;
use File::Basename;
​if( -e $modulesFile ){
    $modulesFile = Cwd::abs_path($modulesFile);
    $targetFile = basename($modulesFile);
}

-Filter out non-ascii characters , remain ascii characters only.

$tt =~ s/[^[:ascii:]]//g;

-Change the string's coding to utf8.

Encode::_utf8_on($chinese);

-Load properties files.

open DICT_PROPS, "< ".$dictionary_file   or die "unable to open dictionary";

my $dict_properties = new Config::Properties();
$dict_properties->load(*DICT_PROPS);
close DICT_PROPS;

$srcText= "Hello world!";
$theV =  $dict_properties->getProperty(Digest::MD5::md5_base64($srcText));

 注册OKEx并首次购买金额在200-1000元之间数字货币,您可获得价值20元的比特币奖励  点击链接 OKEX交易所(国内三大之一)。

最后,提供几个福利,不用科学上网也能注册或访问几大交易所:

1,注册OKEX,请访问 http://www.okex.me/

2,注册币安,请访问 http://www.binancezh.com/ 

End