in reply to How to remove an apostrophe?
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];
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to remove an apostrophe?
by sfhazel (Novice) on Oct 12, 2005 at 18:40 UTC | |
by ikegami (Patriarch) on Oct 12, 2005 at 18:56 UTC |