FAQ
hi,
are any module that can parse text files with some definitions of
segment that i define?

i have a file where the blocks starts with [foo] and last to the next
block.

thx
--
Patricio Bruna http://www.linuxcenterla.com
Ingeniero de Proyectos Mariano Sánchez Fontecilla 310
Red Hat Certified Engineer Las Condes, Santiago - CHILE
Linux Center Latinoamerica Fono: 2745000

Search Discussions

  • Jay at Jan 4, 2005 at 9:27 pm

    On Tue, 04 Jan 2005 18:05:46 -0300, Patricio Bruna V wrote:
    hi,
    are any module that can parse text files with some definitions of
    segment that i define?

    i have a file where the blocks starts with [foo] and last to the next
    block.

    thx

    The short answer is: yes, lots of them. most of them are designed for
    specific, standard instances of [foo], though (html, xml, MARc
    records, BSD fortunes, etc.). If you're working with a standard
    record type, do a cpan search, something will probably turn up.

    If all you need to do is read from one record separator to the next,
    though, you don't even need a module. Pull up 'perldoc perlvar' and
    have a look at the $/ variable.

    HTH,

    jay
  • Chris Devers at Jan 6, 2005 at 3:16 am

    On Tue, 4 Jan 2005, Patricio Bruna V wrote:

    are any module that can parse text files with some definitions of
    segment that i define?
    Depending on what the format is, yes, maybe.
    i have a file where the blocks starts with [foo] and last to the next
    block.
    The Windows .ini config file format looks a bit like that: you have
    sectons flagged with a [foo] token, followed by a series of "a = b"
    parameters, with a file consisting of one or more sections.

    If that is the format you're dealing with, then Config::INI is (if I
    remember correctly -- verify at http://search.cpan.org/) the module you
    need.

    Of course, the .ini format is really simple, and writing your own parser
    wouldn't be that hard to do either, but when the library already exists
    to do the work for you, you might as well lean on that so you can go do
    more interesting things with your code ...



    --
    Chris Devers

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupbeginners @
categoriesperl
postedJan 4, '05 at 8:55p
activeJan 6, '05 at 3:16a
posts3
users3
websiteperl.org

People

Translate

site design / logo © 2022 Grokbase