in reply to Parsing a config file
Hi tcf03
if your config file is always that simple, you could use a regex to parse it, like
#!/usr/bin/perl -l use strict; use warnings FATAL => "all"; my $stuff; { $/= undef; $stuff = <DATA>; } while ($stuff =~ /<server>\n(.*?)<\/server>/msg){ print join ",", split "\n", $1 ; } __DATA__ <server> printserver1 default cups cups </server> <server> printserver2 no aix rsh </server> __END__ this returns printserver1,default,cups,cups printserver2,no,aix,rsh
If it can get much more complicated than this, you may have to consider alternatives
I hope this helps
thinker
In Section
Seekers of Perl Wisdom