I'd choose another way and use one of myriad Config::* CPAN modules. For example, with Config::Tiny you can do something similar to (after removing everything before the first section in your data file):
use warnings; use strict; use Config::Tiny; my $cfg = Config::Tiny->read('test.txt') or die "Couldn't read file: $ +Config::Tiny::errstr"; for my $sect (values %$cfg) { my ($name, $version, $publisher) = map { $sect->{$_} } qw("Display +Name" "DisplayVersion" "Publisher"); print "Name: $name\nVersion: $version\nPublisher: $publisher\n"; + }
In reply to Re: Some regex magic
by przemo
in thread Some regex magic
by monkie
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |