Tim Johnson wrote:
> 
> I'm not really giving you the answer you're looking for, but here is one way
> to go about it:
> 
> while(<>){
>   my @temp = split(/\|/,$_);
>   foreach my $item(@temp){
>     if($item eq ''){
>       $item .= ' ';
>     }
>   }
>   print join('|',@temp);
> }

Or you could write that as:

while ( <> ) {
    print join '|', map length() ? $_ : ' ', split /\|/;
    }

But of course that won't work properly if the last field is empty.

while ( <> ) {
    chomp;
    print join( '|', map length() ? $_ : ' ', split /\|/, $_, -1 ), "\n";
    }



John
-- 
use Perl;
program
fulfillment

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

Reply via email to