If you want to access the removed part of the string, try:
$name =~ s/^(.*?)(\s*)$/$1/;
It is almost the same that you tried but with two little differences: the first quantifier is not greedy (*? instead of *) so it will not eat up the spaces and the second part of the expression now catches all \s characters until the end of line.
Rule One: Do not act incautiously when confronting a little bald wrinkly smiling man.
In reply to Re^2: Converting decimal value to hex
by psini
in thread Converting decimal value to hex
by coldmiser
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |