What I want are these array members from a string in a database. I'm
almost there, just need to strip off the trailing pipe, but I am getting
empty members too, so will have to test for that and dump the empty ones
before proceeding. Is this the best solution? {No, we can't change the
database format}

Many thanks in advance,
Jo


police record
dwelling=(apt|condo)
pet=(dog|cat)
marital=single
vacation
=================================
#!/usr/bin/perl -Tw

use strict;

print "\n";
my $one="";
my $string="police
record|dwelling=(apt|condo)|pet=(dog|cat)|marital=single|vacation";
my @items = split (/([^|()]+\|{1}|[^|()]+[(][^()]+[)]\|{1})/,$string);
foreach $one (@items) {
        print "_".$one."_\n";
}
exit;
=================================
__
_police record|_
__
_dwelling=(apt|condo)|_
__
_pet=(dog|cat)|_
__
_marital=single|_
_vacation_


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to