From mark at arricc.net Fri Mar 10 06:22:29 2006 From: mark at arricc.net (Mark McRitchie) Date: Fri, 10 Mar 2006 14:22:29 +0000 (GMT) Subject: [Aberdeen-pm] Quick perl fix needed Message-ID: Heyas, I need to convert a string in the form: Into an associative array eg: arr(key)=value arr(key2)=value2 Is there a quick way to do this? Yes its an XML string, but I want to do it without having to use any extra packages... Cheers! Mark. From znxster at gmail.com Fri Mar 10 08:27:23 2006 From: znxster at gmail.com (znx) Date: Fri, 10 Mar 2006 16:27:23 +0000 Subject: [Aberdeen-pm] Quick perl fix needed In-Reply-To: References: Message-ID: <169ffc030603100827m84e4cbcw@mail.gmail.com> Not pretty.. I'm sure there is a better way.. ------ $_ = ""; foreach(split(' ([\w="\']+)')) { if(/=/) { ($a, $b) = split(/=/); $array{$a} = $b; } } print $array{'keya'}; ---- M On 10/03/06, Mark McRitchie wrote: > Heyas, > > I need to convert a string in the form: > > > Into an associative array eg: > arr(key)=value > arr(key2)=value2 > > Is there a quick way to do this? Yes its an XML string, but I want to do > it without having to use any extra packages... > > Cheers! > Mark. > _______________________________________________ > Aberdeen-pm mailing list > Aberdeen-pm at pm.org > http://mail.pm.org/mailman/listinfo/aberdeen-pm > From mark at arricc.net Fri Mar 10 08:39:34 2006 From: mark at arricc.net (Mark McRitchie) Date: Fri, 10 Mar 2006 16:39:34 +0000 (GMT) Subject: [Aberdeen-pm] Quick perl fix needed In-Reply-To: <169ffc030603100827m84e4cbcw@mail.gmail.com> References: <169ffc030603100827m84e4cbcw@mail.gmail.com> Message-ID: Cool, that looks a lot better than the way I ended up doing it :) Glad you're looking for quoted values as I forgot to put that in my original msg :D Cheers! Mark. On Fri, 10 Mar 2006, znx wrote: > Not pretty.. I'm sure there is a better way.. > > ------ > $_ = ""; > > foreach(split(' ([\w="\']+)')) { > if(/=/) { > ($a, $b) = split(/=/); > $array{$a} = $b; > } > } > > print $array{'keya'}; > ---- > > M > On 10/03/06, Mark McRitchie wrote: > > Heyas, > > > > I need to convert a string in the form: > > > > > > Into an associative array eg: > > arr(key)=value > > arr(key2)=value2 > > > > Is there a quick way to do this? Yes its an XML string, but I want to do > > it without having to use any extra packages... > > > > Cheers! > > Mark. > > _______________________________________________ > > Aberdeen-pm mailing list > > Aberdeen-pm at pm.org > > http://mail.pm.org/mailman/listinfo/aberdeen-pm > > > _______________________________________________ > Aberdeen-pm mailing list > Aberdeen-pm at pm.org > http://mail.pm.org/mailman/listinfo/aberdeen-pm > From ghenry at perl.me.uk Fri Mar 10 14:37:05 2006 From: ghenry at perl.me.uk (Gavin Henry) Date: Fri, 10 Mar 2006 22:37:05 -0000 (GMT) Subject: [Aberdeen-pm] Quick perl fix needed In-Reply-To: References: Message-ID: <34615.192.168.100.90.1142030225.squirrel@webmail.suretecsystems.com> > Heyas, > > I need to convert a string in the form: > > > Into an associative array eg: > arr(key)=value > arr(key2)=value2 I think you mean a hash. > > Is there a quick way to do this? Yes its an XML string, but I want to do > it without having to use any extra packages... The quick way is to use a module, as many people have worked on the various XML ones, hence are more accurate and bug free compared to what we could write ;-) > > Cheers! > Mark. > _______________________________________________ > Aberdeen-pm mailing list > Aberdeen-pm at pm.org > http://mail.pm.org/mailman/listinfo/aberdeen-pm > From ghenry at perl.me.uk Fri Mar 10 14:43:01 2006 From: ghenry at perl.me.uk (Gavin Henry) Date: Fri, 10 Mar 2006 22:43:01 -0000 (GMT) Subject: [Aberdeen-pm] Quick perl fix needed In-Reply-To: <169ffc030603100827m84e4cbcw@mail.gmail.com> References: <169ffc030603100827m84e4cbcw@mail.gmail.com> Message-ID: <53641.192.168.100.90.1142030581.squirrel@webmail.suretecsystems.com> > Not pretty.. I'm sure there is a better way.. > > ------ > $_ = ""; > > foreach(split(' ([\w="\']+)')) { > if(/=/) { > ($a, $b) = split(/=/); > $array{$a} = $b; > } > } > > print $array{'keya'}; This is a hash, not an array ;-) Use http://search.cpan.org/dist/XML-Simple/ for proper parsing that is tried and tested. > ---- > > M > On 10/03/06, Mark McRitchie wrote: >> Heyas, >> >> I need to convert a string in the form: >> >> >> Into an associative array eg: >> arr(key)=value >> arr(key2)=value2 >> >> Is there a quick way to do this? Yes its an XML string, but I want to do >> it without having to use any extra packages... >> >> Cheers! >> Mark. >> _______________________________________________ >> Aberdeen-pm mailing list >> Aberdeen-pm at pm.org >> http://mail.pm.org/mailman/listinfo/aberdeen-pm >> > _______________________________________________ > Aberdeen-pm mailing list > Aberdeen-pm at pm.org > http://mail.pm.org/mailman/listinfo/aberdeen-pm > From ghenry at perl.me.uk Fri Mar 10 14:52:26 2006 From: ghenry at perl.me.uk (Gavin Henry) Date: Fri, 10 Mar 2006 22:52:26 -0000 (GMT) Subject: [Aberdeen-pm] Quick perl fix needed In-Reply-To: References: Message-ID: <38809.192.168.100.90.1142031146.squirrel@webmail.suretecsystems.com> > Heyas, > > I need to convert a string in the form: > > > Into an associative array eg: > arr(key)=value > arr(key2)=value2 > > Is there a quick way to do this? Yes its an XML string, but I want to do > it without having to use any extra packages... For the group, we have available copies of the Perl CD Bookshelf 3.0 and 4.0 , which have the Perl XML book in it. I recommend reading: http://perl-xml.sourceforge.net/faq/ Gentle intro: http://builder.com.com/5100-6371-5363190.html It's much safer to use XML::Simple etc. Mark, as it will save you headaches in the long run! > > Cheers! > Mark. > _______________________________________________ > Aberdeen-pm mailing list > Aberdeen-pm at pm.org > http://mail.pm.org/mailman/listinfo/aberdeen-pm > From mark at arricc.net Sat Mar 11 03:31:42 2006 From: mark at arricc.net (Mark McRitchie) Date: Sat, 11 Mar 2006 11:31:42 +0000 (GMT) Subject: [Aberdeen-pm] Quick perl fix needed In-Reply-To: <34615.192.168.100.90.1142030225.squirrel@webmail.suretecsystems.com> References: <34615.192.168.100.90.1142030225.squirrel@webmail.suretecsystems.com> Message-ID: On Fri, 10 Mar 2006, Gavin Henry wrote: > > Into an associative array eg: > I think you mean a hash. Different names for the same thing :P > > Is there a quick way to do this? Yes its an XML string, but I want to do > > it without having to use any extra packages... > > The quick way is to use a module, as many people have worked on the > various XML ones, hence are more accurate and bug free compared to what we > could write ;-) I don't want to use any extra modules as that would involve remastering the CD we use to build our PCs with to include the extra modules. It was the quickest and easiest way we could think of to get a very basic linux to query our SQLServers. I may make a request to the project to add XML modules to the next version. Mark. From ghenry at perl.me.uk Sat Mar 11 10:30:34 2006 From: ghenry at perl.me.uk (Gavin Henry) Date: Sat, 11 Mar 2006 18:30:34 -0000 (GMT) Subject: [Aberdeen-pm] Quick perl fix needed In-Reply-To: References: <34615.192.168.100.90.1142030225.squirrel@webmail.suretecsystems.com> Message-ID: <54174.192.168.100.90.1142101834.squirrel@webmail.suretecsystems.com> > On Fri, 10 Mar 2006, Gavin Henry wrote: >> > Into an associative array eg: >> I think you mean a hash. > > Different names for the same thing :P Yeah, but common is a hash ;-) > >> > Is there a quick way to do this? Yes its an XML string, but I want to >> do >> > it without having to use any extra packages... >> >> The quick way is to use a module, as many people have worked on the >> various XML ones, hence are more accurate and bug free compared to what >> we >> could write ;-) > > I don't want to use any extra modules as that would involve remastering > the CD we use to build our PCs with to include the extra modules. Ah, now I understand. > > It was the quickest and easiest way we could think of to get a very basic > linux to query our SQLServers. > > I may make a request to the project to add XML modules to the next > version. Yeah, if it gets more complicated, best thing to do. > > > Mark. > _______________________________________________ > Aberdeen-pm mailing list > Aberdeen-pm at pm.org > http://mail.pm.org/mailman/listinfo/aberdeen-pm > From webmaster at perl.me.uk Mon Mar 20 23:46:24 2006 From: webmaster at perl.me.uk (ghenry) Date: Tue, 21 Mar 2006 07:46:24 +0000 Subject: [Aberdeen-pm] Perl 5.8.8 out (Forgot to mention) Message-ID: Oops, was out on Feb 02, 2006! Grab it at http://www.perl.com/download.csp#stable From webmaster at perl.me.uk Mon Mar 20 23:48:05 2006 From: webmaster at perl.me.uk (ghenry) Date: Tue, 21 Mar 2006 07:48:05 +0000 Subject: [Aberdeen-pm] YAPC Birmingham (TBA) Message-ID: I am going. Anyone else fancy coming? http://www.yapceurope.org/ From webmaster at perl.me.uk Mon Mar 20 23:53:19 2006 From: webmaster at perl.me.uk (ghenry) Date: Tue, 21 Mar 2006 07:53:19 +0000 Subject: [Aberdeen-pm] Fedora Core 5 Out! Message-ID: At last! https://www.redhat.com/archives/fedora-announce-list/2006-March/msg00027.html http://fedoraproject.org/wiki/FC5ReleaseSummary http://fedora.redhat.com/docs/release-notes/fc5/ From webmaster at perl.me.uk Thu Mar 30 11:49:43 2006 From: webmaster at perl.me.uk (ghenry) Date: Thu, 30 Mar 2006 20:49:43 +0100 Subject: [Aberdeen-pm] Samba-LDAP hits 0.01! ;-) Message-ID: FYI: http://search.cpan.org/~ghenry/ Gavin.