Liam Liam - 6 months ago 14x
Perl Question

Performing a right trim against a string

I'm attempting to perform the equivalent of a simple right trim in Perl using a regex.

I have the value

assigned to the string
, I'm attempting to trim the colon from the end.

I have the following code which attempts to trim the colon, with this code
is still set to
however. Can anyone suggest what the issue is here?

my $test = '1445:';
$test =~ s/:$//;


That can't be the code you ran because it works.

$ perl -e'
    my $test = "1445:";
    $test =~ s/:$//;
    print "$test\n";

Perhaps $test contained in the code you ran was different. Check with

use Data::Dumper;
local $Data::Dumper::Useqq = 1;