in reply to Re: Merge log files causing Out of Memory
in thread Merge log files causing Out of Memory
&date_calc; and &get_dirs; is Perl4-style. Avoid the ampersand, it usually does not do what you intent to do.
is not Perl4, is perfectly valid Perl5, and is reffered by official docs as optional in modern perl
It is still not optional in three cases:
# while naming a sub like in: defined &my_sub_name; # doing indirect sub call (but $subref->() is another valid option) &$subref(); # making a reference to a sub $coderef = \&handler;
..it usually does not do what you intent to do.just means that &get_dirs receive the current @_ even if no args are specified. The programmer must be aware of this and the feature can be also used in a profitable way.
The example in perlsub is exahustive:
&foo(1,2,3); # pass three arguments foo(1,2,3); # the same foo(); # pass a null list &foo(); # the same &foo; # foo() get current args, like foo(@_) !! foo; # like foo() IFF sub foo predeclared, else "foo"
L*
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Merge log files causing Out of Memory (just a note on ampersand)
by hippo (Archbishop) on Aug 25, 2016 at 10:57 UTC | |
by Discipulus (Canon) on Aug 25, 2016 at 11:16 UTC | |
|
Re^3: Merge log files causing Out of Memory (just a note on ampersand)
by afoken (Chancellor) on Aug 26, 2016 at 06:20 UTC | |
|
Re^3: Merge log files causing Out of Memory (just a note on ampersand)
by choroba (Cardinal) on Aug 25, 2016 at 20:39 UTC |