[Chicago-talk] Arguments

Steven Lembark lembark at wrkhors.com
Sun Jan 18 23:23:09 CST 2004



-- petemar1 <petemar1 at perlmonk.org>

> On "juggling arguments:"
>
> When you have a...
>
>     sub doSomething(\$) {
>
>         doSomethingElse($_);    # Is this correct...
>         doSomethingElse($_[1]); # ...or is this correct?
>
>     } # end doSomething()

er, why not just drop the prototypes since they will
likely cause you more problems than they're worth,
use the standard passing and deal with is $_[0]?

	my $something = shift;

	ref $something or croak "Bogus something: arg not a referent";

	# add a separate test for ref $something ~= /FOOBAR/ if you
	# really care. at that point anyone following you has some
	# pretty specific internal docs on exactly what's going on
	# in the tests and error messages.


	$something->else;

or

	else $something;

or

	else shift;

or

	or $_[0]->else;



--
Steven Lembark                               2930 W. Palmer
Workhorse Computing                       Chicago, IL 60647
                                            +1 888 359 3508



More information about the Chicago-talk mailing list