@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'));
I have the above code which returns the following in this format:
Sent:
30 March 2017 11:59
I need it to be in this format:
Sent: 30 March 2017 11:59
They are indents and not just spaces, i have tried grep, trim and various substitution methods suggested in other forums and threads to no luck.
The following lines can be used to truncate all whitespaces from a multiline string. I would rather sugest putting these lines in to function.
@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