in reply to Re^2: unless weirdness
in thread unless weirdness

In that case you must call your sub as follows :
check_disk_space()
From perldoc perlsub:
A subroutine may be called using an explicit & prefix. The & is optional in modern Perl, as are parentheses if the subroutine has been predeclared.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Replies are listed 'Best First'.
Re^4: unless weirdness
by ikegami (Patriarch) on May 08, 2009 at 06:34 UTC
    That quote is misleading. "&" has side-effects. It's purpose isn't to get around declaring a sub.
      Its purpose isn't to get around declaring a sub.

      Yes and no. It's an unambiguous parser hint that the following potential bareword isn't a bareword but a subroutine call. I hate it too, but that's one of its functions.

Re^4: unless weirdness
by Plankton (Vicar) on May 08, 2009 at 21:02 UTC
    Why doesn't that apply to ...
    die "Not enough disk space.\n" if check_disk_space;
    ... ?