HELP: 'write' in perl 5.001 doesn't write "\n" 
Author Message
 HELP: 'write' in perl 5.001 doesn't write "\n"

I have a 'write' format defined as


$name,                 $value
~~                     ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                       $value
.

if my $name = "address",
      $value = "company name\nstreet\ncity\nstate zip\ntelephone\nfax"

and have

        $oldfh = select(STDOUT);
        $~ = "FORM_LINE";
        select($oldfh);

        $~ = "FORM_LINE";
        write;

in my perl script, the output would be like

        address         company name street city state zip telephone fax

rather than what I expected:

        address         company name
                        street
                        city
                        state zip
                        telephone
                        fax

Did I do the right format setting, or it is a bug in perl 5.001? What
is the way to get output using 'write' in the format I want? I need
this format to work for several strings in different lengths and
having different number of "\n".

Thanks,

        zhao



Sun, 29 Nov 1998 03:00:00 GMT  
 HELP: 'write' in perl 5.001 doesn't write "\n"

Quote:

> I have a 'write' format defined as
> [snip]

Zhao, the ^ report formating character ignores all newlines in the variable.

david



Tue, 01 Dec 1998 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Image::Magick->Write() doesn't want to write

2. Help: Perl Script Doesn't Write Out

3. Apache, embperl, mod_perl : require doesn't work and can't write to file

4. /\|/ works but "\|" doesn't

5. TieRegistry doesn't "take"

6. "use" doesn't like variables

7. Help writing 'simple' loop

8. Perl 5.001 compile problem: argument doesn't match function prototype

9. 'write' to non-STDOUT help needed

10. SelfLoader and 'open(FH, "-|")'

11. SelfLoader and 'open(FH, "-|")'

12. PL41 BUG: pack('c',0) ne sprintf("%c",0)

 

 
Powered by phpBB® Forum Software