in reply to Re: Re: Worst thing you ever made with Perl
in thread Worst thing you ever made with Perl

Ewwww. Significant whitespace? You're kidding, right? I thought I dodged that bullet when I quit trying to learn Python and stuck with Perl.


$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/

Replies are listed 'Best First'.
Re: Re: Worst thing you ever made with Perl
by Juerd (Abbot) on Sep 30, 2003 at 20:46 UTC

    Significant whitespace?

    Yes.

    You're kidding, right?

    No.

    I thought I dodged that bullet when I quit trying to learn Python and stuck with Perl.

    print 3 . 5; # 35 print 3.5; # 3.5 %foo = (bar => "xyzzy") print "-$foo{bar}-"; # -xyzzy- print "-$foo {bar}-"; # - {bar}- $a = 1; print $a - -5; # 6 print $a -- 5; # error print q qhelloq; # hello print qqhelloq; # qqhelloq
    Etcetera, etcetera. Get used to it. Yes, POD has significant vertical whitespace.

    Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }

      print 3 . 5; # 35 print 3.5; # 3.5

      Warnings will catch that for you.

      %foo = (bar => "xyzzy") print "-$foo{bar}-"; # -xyzzy- print "-$foo {bar}-"; # - {bar}-

      Putting a space in the middle of a variable is just a wee bit different from indenting lines within a function.

      $a = 1; print $a - -5; # 6 print $a -- 5; # error print q qhelloq; # hello print qqhelloq; # qqhelloq

      All of these examples are highly contrived, and not at all the same as wanting to indent lines to properly reflect a nested structure and being told that no, those lines should not be indented, because the leading whitespace is significant. And as for having blank lines be significant... the English language lacks the words to describe my view of that. At this point I'm thinking I'll probably continue to use comments as I have been doing, after all. The prospect of being able to automatically generate documentation from the POD comments embedded in the code was attractive to me in principle, but apparently it's not flexible enough to be used at all the way I want.


      $;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/

        Putting a space in the middle of a variable is just a wee bit different from indenting lines within a function.

        Is it?

        %foo = (bar => "xyzzy") print $foo{bar}; # xyzzy print $foo {bar}; # xyzzy (!!!) print "-$foo{bar}-"; # -xyzzy- print "-$foo {bar}-"; # - {bar}-

        Juerd # { site => 'juerd.nl', plp_site => 'plp.juerd.nl', do_not_use => 'spamtrap' }