【发布时间】:2021-01-08 04:57:50
【问题描述】:
案例 1:
year$ = ($whole =~ /\d{4}/);
print ("The year is $year for now!";)
输出:The year is The year is 1 for now!
案例 2:
$whole="The year is 2020 for now!";
$whole =~ /\d{4}/;
$year = ($whole);
print ("The year is $year for now!";)
输出:现在是 2020 年!暂时!
有没有办法将 $year 变量设为 2020 年?
【问题讨论】:
标签: regex perl variables perl5.8