On Monday 11 October 2010 13:20:07 Dr.Ruud wrote:
> On 2010-10-08 16:52, Shlomi Fish wrote:
> >     my ($arg1, $arg2, $arg3 ... ) = @_;
> 
> Bad pattern: numbered names.

<sarcasm>Well, thanks for trimming out so much of my message</sarcasm>.

In any case, naturally, I didn't intend that you actually name the arguments 
as "$arg1" , "$arg2" , "$arg3" , etc. literally. This was just done for 
clarity.

An actual use case may be:

[code]
sub send_message_to_user
{
        my $self = shift;

        my $user = shift;

        my ($format, $format_params) = @_;

        # Do some sanity checks
        if (ref($format) ne "")
        {
                confess "Format is not a string!";
        }

        if (ref($format_params) ne "ARRAY")
        {
                confess "Format parameters should be an array reference.";
        }

        return $self->_get_user($user)->send_message(@_);
}
[/code]

A little contrieved, but I've done it before.

Naturally, naming your variables as $name1, $name2, $name3 is indicative that 
you need a hash or an array. See varvarname:

http://perl.plover.com/varvarname.html

Regards,

        Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
http://www.shlomifish.org/humour/ways_to_do_it.html

<rindolf> She's a hot chick. But she smokes.
<go|dfish> She can smoke as long as she's smokin'.

Please reply to list if it's a mailing list post - http://shlom.in/reply .

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to