in reply to User-Defined Sub, Passing a Single Argument?

Method 2 should have parens: my ($arg) = @_;

As for which style to use, it really doesn't matter, it is all a matter of personal taste and I have used all three (though typically one of the first two).

Update: Better phrasing, thanks kennethk

Good Day,
    Dean

Replies are listed 'Best First'.
Re^2: User-Defined Sub, Passing a Single Argument?
by kennethk (Abbot) on Oct 15, 2014 at 17:37 UTC

    You may want to update your phrasing; the choice of method doesn't really matter, but your comment sounds like the parentheses don't matter. The missing parentheses are a bug.


    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.