Leser: 1
9 Einträge, 1 Seite |
moritz+2008-05-28 09:56:04--Wenn jetzt jemand ein č im Namen hat,
use utf8;
1
2
3
4
5
6
7
8
#!/usr/bin/perl -w
use Encode qw(encode decode);
$\ = "\n";
decode('utf-8',"Ärgerlich") =~ '\b\w*e\w*\b';
print $&;
setlocale(LC_CTYPE, "de_DE.UTF-8");
'perldoc perlre'...
WARNING: Once Perl sees that you need one of $& , $` , or $' anywhere in the program, it has to provide them for every pattern match. This may substantially slow your program. Perl uses the same mechanism to produce $1, $2, etc, so you also pay a price for each pattern that contains capturing parentheses. (To avoid this cost while retaining the grouping behaviour, use the extended regular expression (?: ... ) instead.) But if you never use $& , $` or $' , then patterns without capturing parentheses will not be penalized. So avoid $& , $' , and $` if you can, but if you can't (and some algorithms really appreciate them), once you've used them once, use them at will, because you've already paid the price. As of 5.005, $& is not so costly as the other two.
...
9 Einträge, 1 Seite |