Hi all!

I use "format" and "write" for a long time now. Very satisfied with the
results.

But today I tried to "write" a Tab-Separated-Values record. Strange! All
tabs where converted to spaces!

Should I use the write/format at all (i.e. is it deprecated?)

Is there a way to force the write/format to preserve tabs?

 

Meir

 

Here is a small script that does it:

 

# -------------------------------

use strict;

use warnings;

 

my $message = "One\tTwo\tThree\tFour\tFive";

 

open my $log_fh, ">:encoding(utf8)", "TSV_log.txt";

 

format LOG_FORMAT =

~~^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

$message

.

select($log_fh);

$~ = "LOG_FORMAT";

 

write;

 

close $log_fh;

# -------------------------------

 

Its output is (no tabs, just spaces):

 

  One Two Three Four Five*

_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl

Reply via email to