on Wed, 12 Jun 2002 12:16:55 GMT, [EMAIL PROTECTED] (Anders
Holm) wrote: 

> I have a feeling that there will be takers for optimising this as
> well, so enlighten me if you wish....

With a little help from the Cookbook I came up with this:

    #! perl -w
    use strict;

    my %parameters = ();
    my $line;

    while (defined($line = <DATA>)) {
        chomp $line;
        if ($line =~ s/\\\s*$/ /) {
            $line .= <DATA>;
            redo unless eof(DATA);
        }
        $parameters{$1} = [split ' ', $2] 
            if ($line =~ /(.*?)\s*=\s*(.*)/);
    }

    print "Parameter '$_' has values: @{$parameters{$_}}\n" 
        foreach (keys %parameters)
        

    __DATA__
    parameter1 = value1 value2 value3 \
      value4 value5 \
     value6 value7
    parameter2 = another1 another2 another3 \
      another4

-- 
felix

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to