Putting a space in the middle of a variable is just a wee bit different from indenting lines within a function.
Is it?
Yes, absolutely, without qualification, it is
fundamentally different. Indenting everything within
a block is a strongly-recommended best practice in
good coding style, because it greatly enhances clarity.
Being told that I shouldn't do that with POD is as far
as I'm concerned a good enough reason in itself not to
use POD (within blocks -- which is where I wanted to
put the information in question), because I would have
to adopt an unclear coding style in order to do so.
Now I understand why people who use POD stick it all
in big huge chunks, rather than interspersing it
through the code like comments -- because fundamentally
it's not designed to be interspersed the way comments
can be. (I had been led to believe otherwise.)
Putting whitespace in variable names (as,
$foo {bar}) is something I would do in
an obfuscation, to make the code *less* clear. If it
alters the meaning, so what? It isn't something I'd
normally expect good code to ever do, so at worst it's
a very minor gotcha.
$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}}
split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/
| [reply] [d/l] [select] |
Putting whitespace in variable names (as, $foo {bar}) is something I would do in an obfuscation, to make the code *less* clear.
I don't see any whitespace in a variable name. I see whitespace between a variable name and an 'operator' though.
Putting whitespace between '$foo' and '{bar}' is what I do
all the time. It serves exactly the same purpose as
putting whitespace around the addition operator, and between
words in a sentence. Becauselongblobsoftextwithoutspacesinbetweenishardertoread.
Abigail
| [reply] |
This was in the context of interpolation.
Operators aren't interpolated, generally speaking.
(Yeah, I know, methods are interpolated in Perl6...
Perl6 is different in a number of ways (some of which
I look forward to, but I digress).) In Perl5,
$foo{bar} is a scalar value -- hence,
the scalar sigil. If you were referring to the
hash value foo, it would be spelled %foo,
and then anything that followed would be an operator.
(Again, I know a lot of this changes in Perl6... but
there are other corresponding changes surrounding it
that give a consistency Perl5 wouldn't have if $foo
were to refer to %foo in the way you seem to imply.)
As it stands, $foo{bar} is a single
scalar value. That's my story and I'm sticking to it.
$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}}
split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/
| [reply] [d/l] [select] |