perl提取字符串的指定部分

2024-10-30 18:57:24
推荐回答(1个)
回答1:

$str = "real 3m27.496s";
$str =~ /(\d+)m([\d\.]+)s/;
my ( $min, $sec ) = ( $1, $2 );