Andrei Nestor wrote:

aaaa,bbb,"ccccc,ccc",dddd,"eee,eeee"

Cum pot sa parsez stringul asta ca sa obtin urmatoarele?

P1=aaaa
P2=bbb
P3="cccc,ccc"

program exemplu

#!/usr/bin/perl

$a='aaaa,bbb,"ccccc,ccc",dddd,"eee,eeee"';

$b = "$a,";
$c = 0;
$b =~ s!("?)(.*?)(\1),!$c++; print "P$c=$1$2$3\n", ""!ge;

output

$ perl a.pl
P1=aaaa
P2=bbb
P3="ccccc,ccc"
P4=dddd
P5="eee,eeee"

--
Dan Borlovan
Level 7 Software

_______________________________________________
RLUG mailing list
[email protected]
http://lists.lug.ro/mailman/listinfo/rlug

Raspunde prin e-mail lui