Your code works:
$fullName = "c:\\path\\boo's"; @string_parts = split(/\\/,$fullName); foreach $part (@string_parts){ $newName = $part; } $newName =~ s/\'//g; print("$newName\n"); __END__ output ====== boos
Are you sure it's an apostrophe and not a (unicode?) character that looks like one? Or maybe a backtick (`)?
By the way,
foreach $part (@string_parts) { $newName = $part; }
can be reduced to
$newName = $string_parts[-1];
In reply to Re: How to remove an apostrophe?
by ikegami
in thread How to remove an apostrophe?
by sfhazel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |