你如何从数组中的单个元素中删除缩进 - perl?

How do you remove indentation from a single element in an array - perl?

@para_text[2] = $mech->xpath('/html/body/form/table/tbody/tr[2]/td[3]/table/tbody/tr[2]/td/table/tbody/tr[1]/td/table/tbody/tr[4]', type => $mech->xpathResult('STRING_TYPE'));

我有上面的代码 returns 以下格式:

                                    Sent:


                                    30 March 2017 11:59 

我需要它采用这种格式:

发送时间:2017 年 3 月 30 日 11:59

它们是缩进,而不仅仅是空格,我已经尝试过 grep、trim 以及其他论坛和主题中建议的各种替换方法,但都没有成功。

以下行可用于截断多行字符串中的所有空格。我宁愿建议将这些行投入运行。

@para_text[2] =~ s/[\r\n]//gm; # convert multiline to single line
@para_text[2] =~ s/\s*$//;   # remove trailing whitespaces
@para_text[2] =~ s/^\s*//;   # remove preceding whitespaces
@para_text[2] =~ s/\s+/ /;   # merge tabs