sftriman wrote:
I've been wondering for a long time... is there a slick (and hopefully
fast!) way to do this?
foreach (keys %fixhash) {
$x=~s/\b$_\b/$fixhash{$_}/gi;
}
So if
$x="this could be so cool"
and
$fixhash{"could"}="would";
$fixhash{"COOL"}="awesome";
$fixhash{"beso"}="nope";
$fi
2009/12/20 sftriman :
> I've been wondering for a long time... is there a slick (and hopefully
> fast!) way
> to do this?
>
> foreach (keys %fixhash) {
> $x=~s/\b$_\b/$fixhash{$_}/gi;
> }
You can do a global substitute of the sentence and see if they match
any key in the hash. i.e.:
$x =~ s/\b
sftriman wrote:
> I've been wondering for a long time... is there a slick (and hopefully
> fast!) way
> to do this?
>
> foreach (keys %fixhash) {
> $x=~s/\b$_\b/$fixhash{$_}/gi;
> }
>
> So if
>
> $x="this could be so cool"
>
> and
>
> $fixhash{"could"}="would";
> $fixhash{"COOL"}="awesome"
I've been wondering for a long time... is there a slick (and hopefully
fast!) way
to do this?
foreach (keys %fixhash) {
$x=~s/\b$_\b/$fixhash{$_}/gi;
}
So if
$x="this could be so cool"
and
$fixhash{"could"}="would";
$fixhash{"COOL"}="awesome";
$fixhash{"beso"}="nope";
$fixhash{"his"}="impo