in reply to Useless use of reference constructor in void context

Hello myfamilygeneral, and welcome to the Monastery!

The problem is not with $dirtree_frame->destroy, but with the immediately preceding term \&show_cwd(). Consider the following:

#! perl use strict; use warnings; sub foo { print "in foo()\n"; } sub bar { \&foo(); print "in bar()\n"; } bar();

Output:

Useless use of reference constructor in void context at test.pl line 1 +2. in foo() in bar()

But remove the backslash (which does nothing useful anyway) from before &foo(), and the warning goes away.

Update: The & sigil probably does nothing useful either. See What's the difference between calling a function as &foo and foo()?

HTH,

Athanasius <°(((><contra mundum

Replies are listed 'Best First'.
Re^2: Useless use of reference constructor in void context
by ww (Archbishop) on Jul 29, 2012 at 16:19 UTC
    s/The & sigil probably does nothing useful either./The & sigil does nothing useful here, and, generally, may do something you won't like./;
Re^2: Useless use of reference constructor in void context
by Anonymous Monk on Apr 11, 2013 at 10:22 UTC
    Thanks a lot this was very useful.