develooper Front page | perl.perl5.porters | Postings from October 2003


H.Merijn Brand
October 27, 2003 10:37
Message ID:
The last paragraph of perlform sais

      Inside of an expression, the whitespace characters \n, \t and \f are
      considered to be equivalent to a single space.  Thus, you could think
      of this filter being applied to each value in the format:

       $value =~ tr/\n\t\f/ /;

      The remaining whitespace character, \r, forces the printing of a new
      line if allowed by the picture line.

I know nobody cares, but why is \e treated as whitespace? It's not in these
docs, and I cannot think of a valid reason to strip escapes, other than ...
way back when we had paper terminals ...

l1:/pro/3gl/CPAN/perl-current 157 > perl5.8.0 -MO=Deparse merijn/
$_ = "\eE";
format STDOUT =
merijn/ syntax OK
l1:/pro/3gl/CPAN/perl-current 158 > perl5.8.0 -MO=Concise merijn/
e  <@> leave[t1] vKP/REFC ->(end)
7     <0> enter ->8
8     <;> nextstate(main 1 v ->9
b     <2> sassign vKS/2 ->c
9        <$> const(PV "\033E") s ->a
-        <1> ex-rv2sv sKRM*/1 ->b
a           <$> gvsv(*_) s ->b
c     <;> nextstate(main 2 v ->d
d     <0> enterwrite v ->e
merijn/ syntax OK
l1:/pro/3gl/CPAN/perl-current 159 > perl5.8.0 -MO=Terse merijn/
LISTOP (0x4001e170) leave [1]
    OP (0x4002d650) enter
    COP (0x4001e128) nextstate
    BINOP (0x4001e0f8) sassign
        SVOP (0x4001e088) const  PV (0x4001a428) "\033E"
        UNOP (0x4001e058) null [15]
            SVOP (0x4001e028) gvsv  GV (0x4001a314) *_
    COP (0x4002d608) nextstate
    OP (0x4002d5e0) enterwrite
merijn/ syntax OK
l1:/pro/3gl/CPAN/perl-current 160 > perl5.8.0 merijn/ | cat -ve
l1:/pro/3gl/CPAN/perl-current 161 >

enterwrite calls S_doprint which calls CvSTART where I'm lost
I don't see the point (yet) where the \n\r\t\e are tr'd to space

H.Merijn Brand        Amsterdam Perl Mongers (
using perl-5.6.1, 5.8.0, & 5.9.x, and 806 on  HP-UX 10.20 & 11.00, 11i,
   AIX 4.3, SuSE 8.2, and Win2k. 
send smoke reports to:, QA: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About