我想借此從日期/時間刪除分隔符串
Code:
2010-12-21 20:00:00
,使它看起來像這樣:
Code:
20101221200000
這是我嘗試
Code:
#!/usr/bin/perl -w
use strict;
my ($teststring) = '2010-12-21 20:00:00';
my $result = " ";
print "$teststring\n";
$teststring =~ "/(d\{4\})(d\{3\})(d\{3\})(d\{3\})(d\{3\})(d\{3\})/$result";
{
print "$_\n";
print "$result\n";
print "$teststring\n";
}
的最後一件事
它產生了這樣的結果:
Code:
[email protected]:~/Desktop$ ./ptest
2010-12-21 20:00:00
Use of uninitialized value $_ in concatenation (.) or string at ./ptest line 8.
2010-12-21 20:00:00
[email protected]:~/Desktop$
- 感謝
的Perl是相同 – ysth 2010-12-22 10:02:44