in reply to Re: Parsing Large XML
in thread Parsing Large XML

ikegami-

Sorry, I'm new to Perl, and programming in general, and was somewhat confused by your comments. A couple of questions:

- What is an acceptable alternative to $[ ?

- Could you suggest a way to print each result as it is found?

I greatly appreciate your help.

Replies are listed 'Best First'.
Re^3: Parsing Large XML
by ikegami (Patriarch) on Jul 06, 2010 at 16:43 UTC

    What is an acceptable alternative to $[ ?

    Not using it. It adds needless complexity.

    If you insist,

    $[ = 1; $a[$i]
    can be written as
    use constant BASE => 1; $a[$i-BASE]

    At least there's no hidden effect at a distance this way.

    Could you suggest a way to print each result as it is found?

    To print the results instead of saving them in an array, replace the code that places them in the array with the code that print a match.

    for (@stories) { print $fh $_ if /$fields[1]/; }
    A reply falls below the community's threshold of quality. You may see it by logging in.