> open FOUT, ">>/some/path/outputfile.txt";
> open FILE "</some/path/inputfile.txt";

open(FOUT, ">>/some/path/outputfile.txt") or
 die("Error: $!");

open(FILE "</some/path/inputfile.txt") or
 die("Error: $!");

> while<FILE>{
> p="N";
> next if (/.*?\|value_garbage1\|.*?/ ||
> /.*?\|value_garbage2\|.*?/ ||
> /.*?\|value_garbage3\|.*?/);

 my $regex = join '|', 'value_garbage1',
                       'value_garbage2',
                       'value_garbage3';

 next if /$regex/;

>         if(/(.*?)\|(.*?)\|....30 times/){
>                 $p="Y";
>                 do something to $1; #change field 1
>                 do something to $3; #change filed 3
>                 $fld1=$newfld1;
>                 $fld2=$2;
>                 $fld3=$newfld3;
>                 $fld4=$4;....and so on
>         }
>         print FOUT "$fld1|$fld2|...|$fld30|\n" if ($p="Y");

If you put the print inside of the if(), you don't need $p. Look into
the join() function:

 print FOUT join '|', $fld1, $fld2, $fld3;
 print FOUT join '|', @array;
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to