Gossamer Forum
Home : General : Perl Programming :

string manipulation question

Quote Reply
string manipulation question
i want to remove all punctuation from a string, but keep spaces. is this the best way to do it?

$fixlink = $EVENT->{details}->{'title'};
$fixlink =~ s/[\s]/qqqqq/g;
$fixlink =~ s/[\W]//g;
$fixlink =~ s/qqqqq/ /g;
Quote Reply
Re: [delicia] string manipulation question In reply to
Sure , that should work. You could do it by specifying all the charachters you wanna exclude, i.e:

$var =~ s/[\t -\.]//sg;

....but that means you have to specifically enter each character you wanna filter out.


Andy (mod)
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!