ff has asked for the wisdom of the Perl Monks concerning the following question:
The camel book says I'm effectively experiencing
$value =~ tr/\n\t\f/ /;
continuing with: The remaining whitespace character, \r, forces the printing of a new line if the picture line allows it.
Fine, how do I put this to work?
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'; # # Version A $line =~ s/\n/' ' x 50/ge; # Version B #$line =~ tr/\n/\r/; # Version C #mystery_command; # Version D write; __DATA__ Version A: 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 Version B: 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 Version C: 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. Version D: 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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using '/r' with '~~ $var' in format
by grep (Monsignor) on Nov 01, 2002 at 16:53 UTC | |
by ff (Hermit) on Nov 01, 2002 at 22:11 UTC | |
by grep (Monsignor) on Nov 02, 2002 at 00:01 UTC | |
by ff (Hermit) on Nov 05, 2002 at 06:28 UTC | |
|
Re: Using '/r' with '~~ $var' in format
by BrowserUk (Patriarch) on Nov 05, 2002 at 07:05 UTC | |
by ff (Hermit) on Nov 05, 2002 at 23:59 UTC |