in reply to subroutine is confusing
If you declare the sub first#!/usr/bin/perl use strict; use warnings; my_sub(); # works # my_sub; # fails "Bareword not allowed..." print qq{done}; sub my_sub { print qq{here\n} };
you can now use the sub without parens.#!/usr/bin/perl use strict; use warnings; sub my_sub { print qq{here\n} }; my_sub(); # works my_sub; # now works too print qq{done};
I reckon a good bet, in these circumstances, is to always use the parens.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: subroutine is confusing
by jwkrahn (Abbot) on Feb 08, 2008 at 12:46 UTC |