Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Improve readability of Perl code. Naming reference variables.

by hippo (Bishop)
on Jan 19, 2017 at 22:30 UTC ( [id://1179952]=note: print w/replies, xml ) Need Help??


in reply to Improve readability of Perl code. Naming reference variables.

I think, the programmer should have a choice to decide whether he finds it advantageous to include the suffix at given place or not.

Since we are dealing with references here then the programmer clearly does have that choice. viz:

#!/usr/bin/env perl use strict; use warnings; my $var = [1, 3, 5]; my $var_aref = $var; print "var has values: @$var\n"; print "var_aref has values: @$var_aref\n";

So you, the programmer, can pick and choose which name to use at any point (if you so desire).

Replies are listed 'Best First'.
Re^2: Improve readability of Perl code. Naming reference variables.
by hakonhagland (Scribe) on Jan 20, 2017 at 08:52 UTC
    So you would prefer to introduce two reference variables? Sorry, I do not like this idea. I would prefer to keep the number of variables to a minimum. Introducing two variables just for the sake of solving a readability issue seems like a bad idea to me. What if one reference was changed later in the code? Then you must remember to update the other reference at the same place also. This clearly becomes a maintenance problem. And if you forget to update the other variable, there are potential for more confusion.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1179952]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2024-04-23 06:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found