in reply to Improve readability of Perl code. Naming reference variables.
As someone who prefers camelCase I use a more succinct convention.
my $rsSomeValue = \ do { my $val = 42 }; # scalar ref my $raCats = [ qw{ Tiddles Desmo Felix } ] # array ref my $rhAges = { John => 23, Bill => 35 }; # hash ref my $rcDoIt = sub { return $_[ 0 ] * 3 }; # code ref my $rxPat = qr{abc}; # regexp ref my $roObj = Some::Pkg->new() # object ref
If I see something matching m{\$r[sahcxo][A-Z]} I know I'm dealing with a reference.
Cheers,
JohnGG
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Improve readability of Perl code. Naming reference variables.
by hakonhagland (Scribe) on Jan 21, 2017 at 08:49 UTC | |
Re^2: Improve readability of Perl code. Naming reference variables.
by nysus (Parson) on Feb 08, 2017 at 23:11 UTC | |
by johngg (Canon) on Feb 09, 2017 at 00:33 UTC | |
by nysus (Parson) on Feb 09, 2017 at 01:05 UTC | |
by hippo (Archbishop) on Feb 09, 2017 at 08:46 UTC |