It appears to me that the best solution is to declare the variables with our. Is there any way to do this without writing our for each variable or without listing all of the variable names within an our declaration and again when I assign values to them?
Since I am only writing a report with Perl, I don't have a lot of stuff competing for the namespace. I would like to keep the readability high and the amount of redundancy low so that the code is easy to change and easy to read. If I package this into an object with getters and setter later then I can find and replace our with my, but for now I think that our seems to be the best choice. Thoughts?
use strict; # while I would like to do this: # # our # ( # $x = 1; # $y = 2; # ); # # it seems that I must do: use ($x, $y); $x = 1; $y = 2; # or this: our $x = 3; our $y = 4; # before I can do: $x = 5; $y = 6;
should I do the following instead?
use strict; no strict "vars"; $x = 5; $y = 6;
Thank you,
In reply to Is use strict always appropriate?
by Je55eah
in thread Please help me print this hash.
by Je55eah
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |