in reply to Strange substr behavior
AFAIK, this:
will set $DataRead{'StringRead'} to the last 3 characters of itself (or all if < 3 characters)... This:$DataRead{'StringRead'} = substr($DataRead{'StringRead'}, -3);
would remove the last three characters (or all if < 3 characters). Shirley ?substr($DataRead{'StringRead'}, -3) = '' ;
But in any case, would it not be easier to:
if ($DataRead{'StringRead'} =~ s/(\t|\n|\r|\e\[Z|\eq)\z//) { my $term = $1 ; .... } ;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Strange substr behavior
by NateTut (Deacon) on Nov 20, 2008 at 19:25 UTC |