Thread RegEx-en und dann zu String evaluieren (13 answers)
Opened by docsnyder at 2006-09-25 16:12

Linuxer
 2006-09-26 13:16
#70235 #70235
User since
2006-01-27
3891 Artikel
HausmeisterIn

user image
[quote=Ronnie,25.09.2006, 20:50][quote=Ronnie,25.09.2006, 16:39]
Code: (dl )
(not $condition or $a =~ s/foo/bar/) and print $a;
[/quote]
Ein Fehler ist noch drin. Sieht ihn jemand?! ;)[/quote]

Was macht Dein Code, wenn $a kein "foo" enthält?
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/usr/bin/perl
# vim: set ts=4 sw=4 et sta:
use strict;
use warnings;

my ( $cond, $aa );

for $cond ( 0 .. 1 ) {

$aa = 'fix';
( not $cond or $aa =~ s/foo/bar/ ) and print "$cond: $aa\n";

}
meine Beiträge: I.d.R. alle Angaben ohne Gewähr und auf Linux abgestimmt!
Die Sprache heisst Perl, nicht PERL. - Bitte Crossposts als solche kenntlich machen!

View full thread RegEx-en und dann zu String evaluieren