Kredler Stefan wrote:
> 
> there is another loop. The whole construction looks like this:
> 
>  for(@file1) {
>     $_ =~ s/[\r]|[\n]//;        #remove CR and DOS CR

[\r] and [\n] are a character class with a single character so the
brackets are not needed.  The match isn't anchored and the global
modifier isn't used so its not clear if you want to remove the first \r
or \n or the newline at the end.

s/[\r\n]//;  # remove \r or \n anywhere in the string - once
s/\r|\n//;   # remove \r or \n anywhere in the string - once

s/[\r\n]+//; # remove one or more \r or \n anywhere in the string

s/[\015\012]+$//;  # remove one or more carriage return or
                   # line feed characters at the end of the string

s/\s+$//;  # remove one or more of any whitespace (including
           # carriage return and line feed) at the end of the string


>     $_ =~ s/\"//g;              #remove quotes

Quotation marks don't have to be escaped.

tr/"//d;


>     next if ($_ =~ /;;;;;;;|DATUM|GESAMT|ANZAHL/);

"$_ =~ " isn't required as this is the default for m//, s/// and tr///.

next if /;;;;;;;|DATUM|GESAMT|ANZAHL/;


>     @raw=split /;/,$_;

Since you only need two values from the split you can use a list slice.

my ( $rawkey, $rawval ) = (split /;/, $_)[2,3];


>     if ( $raw[3] eq ""){
>       while ( ($key, $value) = each %table ) {
>           if ($raw[2] =~ /$key/) {
>             $raw[3] = $value ;
>             last;
>           }
>       }
>     }

In the previous post you said you were having problems because each()
continues where it left off the last time it was used.

unless ( length $rawval ) {
    for my $key ( keys %table ) {
        if ( $rawkey =~ /\Q$key/ ) {
            $rawval = $table{ $key };
            last;
            }
        }
    }


>    #.....more dataprocessing
>  }# end for loop


John
-- 
use Perl;
program
fulfillment

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

Reply via email to