Thread Suchen mit Array (19 answers)
Opened by Gast at 2004-03-02 10:00

Crian
 2004-03-04 12:45
#80468 #80468
User since
2003-08-04
5873 Artikel
ModeratorIn
[Homepage]
user image
Nö:

Code: (dl )
1
2
3
my $var = "123";

if ($var =~ "^\d+$") { print "jau\n"; }


liefert:

Code: (dl )
1
2
3
4
Unrecognized escape \d passed through at C:\Daten\perl\forum\qr.pl line 3.
Final $ should be \$ or $name at C:\Daten\perl\forum\qr.pl line 3, within string
syntax error at C:\Daten\perl\forum\qr.pl line 3, near "=~ "^\d+$""
Execution of C:\Daten\perl\forum\qr.pl aborted due to compilation errors.


Aber

Code: (dl )
1
2
3
4
my $var = "123";

my $re = qr/^\d+$/;
if ($var =~ $re) { print "jau\n"; }


funktioniert wunderbar.

Allerdings keine Variante mit "..."?\n\n

<!--EDIT|Crian|1078398193-->
s--Pevna-;s.([a-z]).chr((ord($1)-84)%26+97).gee; s^([A-Z])^chr((ord($1)-52)%26+65)^gee;print;

use strict; use warnings; Link zu meiner Perlseite

View full thread Suchen mit Array