in reply to problem with variables

You seem to use pseudo-xml for your config file, so why not using real xml and module that will make your like easier :

use XML::Simple; undef $/; $data = <DATA>; $ref = XMLin($data); print "Volume: " . $ref->{'volume'} . "\n"; print "Issue: " . $ref->{'issue'} . "\n"; print "Year: " . $ref->{'year'} . "\n"; __DATA__ <data> <volume>4</volume> <issue>12</issue> <year>2003</year> </data>

Note that I added a <data> tag around your variables, to make the file xml compliant.

HTH


--
zejames

Replies are listed 'Best First'.
Re^2: problem with variables
by rvosa (Curate) on Sep 15, 2004 at 21:01 UTC
    Or the xmltwig approach:
    use XML::Twig; my $xml = <DATA>; my $twig = new XML::Twig ( TwigHandlers => { 'volume' => sub { print "Volume: " . @_->text . "\n" }, 'issue' => sub { print "Issue: " . @_->text . "\n" }, 'year' => sub { print "Year: " . @_->text . "\n" }, } ); $twig->parse($xml); __DATA__ <data> <volume>4</volume> <issue>12</issue> <year>2003</year> </data>
    (Update: not tested, sorry)