Thread ternary op und Zuweisung: *gnaaaaarl* (7 answers)
Opened by dukeofnukem at 2007-06-22 17:09

esskar
 2007-06-22 18:40
#77753 #77753
User since
2003-08-04
7321 Artikel
ModeratorIn

user image
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/perl

use strict;
use warnings;

my $index = 0;
my @nsi = (q~<nContractID>13523</nContractID>~);

my %xmlstring = (
QueryCId => qr/<nC[o]?ntr[a]?ctID[^>]*>\s*(\d+)\s*<\/nC[o]?ntr[a]?ctID>/s,
);
print "\n1 reg: ", $nsi[$index] =~ /$xmlstring{'QueryCId'}/;

$nsi[$index] =~ /$xmlstring{'QueryCId'}/ ?
print "\nMATCH" :
print "\nNO MATCH";

my $cid = $nsi[$index] =~ /$xmlstring{'QueryCId'}/ ? '' : 'I HATE YOU';
print "\nCID should be empty: ", $cid;

View full thread ternary op und Zuweisung: *gnaaaaarl*