38 |
my $string = shift; |
my $string = shift; |
39 |
my $rules = shift; |
my $rules = shift; |
40 |
|
|
41 |
|
our $ris_result = 1; |
42 |
|
|
43 |
if (ref $rules eq 'HASH') { |
if (ref $rules eq 'HASH') { |
44 |
my @re_find = keys %{$rules}; |
my @re_find = keys %{$rules}; |
45 |
# replace all keys with substitutes from hash "%re_table" |
# replace all keys with substitutes from hash "%re_table" |
46 |
foreach my $find (@re_find) { |
foreach my $find (@re_find) { |
47 |
my $replace = $rules->{$find}; |
my $replace = $rules->{$find}; |
48 |
$string =~ s/$find/$replace/g; |
$ris_result &= ($string =~ s/$find/$replace/g); |
49 |
} |
} |
50 |
} |
} |
51 |
|
|
53 |
foreach my $rule (@{$rules}) { |
foreach my $rule (@{$rules}) { |
54 |
my $find = $rule->[0]; |
my $find = $rule->[0]; |
55 |
my $replace = $rule->[1]; |
my $replace = $rule->[1]; |
56 |
$string =~ s/$find/$replace/g; |
$ris_result &= ($string =~ s/$find/$replace/g); |
57 |
} |
} |
58 |
} |
} |
59 |
|
|