in reply to Is use strict always appropriate?
in thread Please help me print this hash.
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?
Sure
my( $foo, $bar ) = ( 1, 2 );
should I do the following instead?
No, that misses the point , might as well not use strict at all in that case. strict itself confers no benefits; The benefits come from avoidance of the bad practices forbidden by strict :)
To understand these read: See Tutorials: Variable Scoping in Perl: the basics, Coping with Scoping , Mini-Tutorial: Perl's Memory Management, Lexical scoping like a fox, Read this if you want to cut your development time in half!
The free Modern Perl book covers all this too
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
another my vs our subroutine test
by Je55eah (Novice) on Jun 19, 2012 at 07:16 UTC | |
|
Re^2: Is use strict always appropriate?
by Je55eah (Novice) on Jun 19, 2012 at 04:26 UTC | |
by Jenda (Abbot) on Jun 19, 2012 at 15:46 UTC | |
by Anonymous Monk on Jun 20, 2012 at 08:01 UTC | |
by Jenda (Abbot) on Jun 20, 2012 at 13:25 UTC | |
by Anonymous Monk on Jun 19, 2012 at 10:42 UTC | |
|
testing my vs our with subroutines
by Je55eah (Novice) on Jun 19, 2012 at 06:41 UTC |