format picture fields with newlines problem 
Author Message
 format picture fields with newlines problem

I am having trouble formatting a multi-line value field
using output record formats.  I have read in the Camel that
"only text up to the newline is printed." (page 107).

I would think that the following simple program would have
the expected output that follows.

########  test.pl script follows:
#!/usr/local/bin/perl

format STDOUT =
Label:  ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        $data
~~      ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
        $data
.

$data = sprintf("1\n2\n3\n4\n5\n6\n");
write;
########  end of script

########  test.pl expected output follows:
Label:  1
        2
        3
        4
        5
        6
########  end of output

However, the actual output is follows.

########  test.pl actual output follows:
Label:  1 2 3 4 5 6
########  end of output


values.  However, the output following the Label: line is
not indented.

Could somebody in the know please point out the errors of
my ways, or at least point me to somebody that knows.

Thanks in advance.

JohnM
_______________________________________________________________________________

John E. Mendenhall                                    Research Systems Engineer
Electronic Data Systems  5400 Legacy Drive  Mailstop H4-GF-20  Plano, TX  75024

_______________________________________________________________________________



Mon, 26 Aug 1996 01:03:45 GMT  
 format picture fields with newlines problem


Quote:
> I am having trouble formatting a multi-line value field
> using output record formats.  I have read in the Camel that
> "only text up to the newline is printed." (page 107).

> I would think that the following simple program would have
> the expected output that follows.
[snip]

> values.  However, the output following the Label: line is
> not indented.

> Could somebody in the know please point out the errors of
> my ways, or at least point me to somebody that knows.

Multiline fields don't work that way.  Here's what I do:

write;



This works for me.

--
William R. Ward              Unix contractor               Apple PIE DTS
Work phone: 408/974-3668                         Voicemail: 408/479-4072

------------------------------------------------------------------------
   Disclaimer: I do not speak for Apple Computer or anyone but myself



Sat, 07 Sep 1996 06:10:11 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. PERLFUNC: format - declare a picture format with use by the write() function

2. PERLFUNC: format - declare a picture format with use by the write() function

3. newline problem with formatted write

4. Highlit fields in 'format' fields

5. Problem formatting with @* (multiline field)

6. MSAccess OLE bound fields to display pictures

7. splitting on newline, not stripping trailing null fields

8. HELP: TEXTAREA field and newlines

9. numeric format, commas, etc, like picture

10. Printing newlines in format statements

11. Newlines in formats

12. Picture problem (upload problem)

 

 
Powered by phpBB® Forum Software