in reply to Using '/r' with '~~ $var' in format

This seems close to your Version D?

Update:Unfortunately, the operative word in that sentance is "looks". The reality when tested with longer text is that it does no wrappong whatsoever. My apologies.

I also got something that got closer by doing $line =~ s/\n/\r/g; and repeating the the last two lines in your original format a bunch of times. It wraps the long line ok and places the horizontal rule underneath, but then the rest of the sig just disappears into the ether. :(

my $last_line_label = 'IMPRESSION/PLAN: '; my $line = 'I discussed otitis media with her but since her ears are +normal today, we do not need to do anything with them. _____________________________ Marcus Welby, M.D. MW/bnj'; format FLDFMT = @<<<<<<<<<<<<<<<<^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $last_line_label, $line @* $line . $~ = 'FLDFMT'; write; __END__ C:\test>209620 IMPRESSION/PLAN: I discussed otitis media with her but since her ears are normal today, we do not need to do anything with them. _____________________________ Marcus Welby, M.D. MW/bnj C:\test>

Nah! Your thinking of Simon Templar, originally played by Roger Moore and later by Ian Ogilvy

Replies are listed 'Best First'.
Re: Using '/r' with '~~ $var' in format
by ff (Hermit) on Nov 05, 2002 at 23:59 UTC
    I also got something that got closer by doing $line =~ s/\n/\r/g; and repeating the the last two lines in your original format a bunch of times. It wraps the long line ok and places the horizontal rule underneath, but then the rest of the sig just disappears into the ether. :(

    Yes, I tried /s and decided that the more efficient (?) tr would be just as well to present since they gave equally "not quite right" results. And BTW, it's cheating to repeat the last two lines of the format! :-) I have a little subroutine on the side that builds up the format string all by itself, i.e. no human intervention to say how many times to 'repeat' the lines. Although if some sample code shows how this is actually a solution, bring it on!

    The other thing is, in what appears to be output below the __END__ statement, we have lost the hanging block effect I have in mind for $line. The fact that my sample text ($line) with the newlines is a signature block is irrelevant; I'm just trying to build a general purpose format statement that plays out a variable that happens to have embedded newlines. Thanks though!