SPUG: Rebuked...
Andrew Sweger
andy at n2h2.com
Tue Jan 4 14:08:49 CST 2000
On Jan 4, 2000 @ 11:09am, Steve Laybourn wrote:
> > sub Cur {
> > my( $ix ) = shift;
>
> ---Let local variable $ix equal the first element of the default array @_,
> which in this case also equals $_. Hmmm, clever, that. How would you handle
> more than one element going in to the array? @_[0], at _[1], etc.?
Time for a little more grabbing and shaking. $_ has nothing to do with @_
(other than sharing an entry in the symbol table). $_[0] is the scalar
contained in the first (or zeroth if you prefer) element of the @_ array.
@_[0] refers to an array slice, albeit containing a single element (a list
of one scalar).
--
Andrew Sweger <andy at n2h2.com> N2H2, Incorporated
900 Fourth Avenue, Suite 3400
No thanks, I'll just have the Seattle WA 98164-1059
Linux with a side of Perl http://www.n2h2.com/ (206) 336-2947
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe
Email to majordomo at pm.org: ACTION spug-list your_address
More information about the spug-list
mailing list