I don't understand why people say that perl's flexibility is a negative.
Bad code is a negative. You can have bad or inconsistent code even in a
language like python that has very rigid syntax.
As long as you know perl well, you should be able to read any
well-written perl code.
To me, both of those examples are equally readable, though, I'd lean
more towards a multiline approach with the second:
my %user = (
login => 'mc',
shell => 'bin/zsh',
);
On Thu, Jan 02, 2020 at 04:22:08PM +0100, Marc Chantreux wrote:
> hello,
>
> > > my %user = qw(
> > > login mc
> > > shell /bin/zsh
> > > );
> > > print $user{login};
>
> > my %user = ( login => 'mc', shell => 'bin/zsh');
> > is way more readable in that case, I think,
> > and it does showcase what a *smart* quoting system can do.
>
> well ... i prefer the way i wrote because i love to:
>
> * remove useless symbols
> * read columns
>
> but yes: the drawback of perl is: there are so many ways to do
> it so every project needs a clear coding style.
>
> regards
> marc
>
No comments:
Post a Comment