[Israel.pm] Re: Replace with Variable content

FeLixel felix.liberman at gmail.com
Thu Oct 13 13:26:53 PDT 2005


Hi Ido,

> Now as you can see, this code will not be allowed to be used. So my
> question is how can I do something in this idea ?

Sorry, but I don't see any problem with this code:

________________________ Code _____________________________
#!/usr/bin/perl -w
use strict;

my $str= 'This is a test string where all illegal chars should be removed!';
my $allowedChars = "a-zA-Z\x{50D}";

print "str before:($str)\n";
$str =~ s/[^$allowedChars]//gs;
print "str after: ($str)\n";
_______________________ Output _____________________________
str before:(This is a test string where all illegal chars should be removed!)
str after: (Thisisateststringwhereallillegalcharsshouldberemoved)
___________________________________________________________

Regards,

    Felix.




More information about the Perl mailing list