[sf-perl] perlstyle
David Christensen
dpchrist at holgerdanske.com
Thu Jul 15 13:47:48 PDT 2021
San Francisco Perl Mongers:
Regarding the "perlstyle" document [1]:
1. Under "Regarding aesthetics of code lay out ...", "Space after last
parenthesis matching on current line" would seem to only make sense when
additional code follows a closing parenthesis. E.g.
if ( ... ) {
...
}
And:
my $x = foo( ... ) && ... ;
But not:
my $z = bar( ... );
2. Under "Along the same lines, just because you CAN omit parentheses
...", what is "num" in the example code?
return print reverse sort num values %array;
My Perl says:
2021-07-15 13:19:07 dpchrist at dipsy ~/sandbox/perl
$ cat /etc/debian_version ; uname -a ; perl -v | head -n 2 | tail -n 1
10.10
Linux dipsy 4.19.0-17-amd64 #1 SMP Debian 4.19.194-2 (2021-06-21)
x86_64 GNU/Linux
This is perl 5, version 28, subversion 1 (v5.28.1) built for
x86_64-linux-gnu-thread-multi
2021-07-15 13:19:11 dpchrist at dipsy ~/sandbox/perl
$ cat perlstyle-num.pl
#!/usr/bin/env perl
use strict;
use warnings;
my %array = ( a => 1, b => 2, c => 3 );
sub foo { return print reverse sort num values %array }
foo();
2021-07-15 13:19:25 dpchrist at dipsy ~/sandbox/perl
$ perl perlstyle-num.pl
Undefined sort subroutine "main::num" called at perlstyle-num.pl line 7.
Comments?
David
[1] https://metacpan.org/dist/perl/view/pod/perlstyle.pod
More information about the SanFrancisco-pm
mailing list