For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > April 2005 > my (fooref) = shift;









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author my (fooref) = shift;
Matthew Sacks

2005-04-27, 8:56 pm

I see many examples in the camel book where a
subroutine takes one argument and the one argument is
an array ref.

my (foo_ref) = shift;

There is however at least one example where it is

my foo_ref = shift;

I am trying to figure out if this matters. What would
shift care about list context? shift should still
yield one thing an array ref??? See page 356 in
the camel book, and page 224. (I think).
matthewsacks1415@yahoo.com


________________________________________
__________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
John W. Krahn

2005-04-27, 8:56 pm

Matthew Sacks wrote:
> I see many examples in the camel book where a
> subroutine takes one argument and the one argument is
> an array ref.
>
> my (foo_ref) = shift;
>
> There is however at least one example where it is
>
> my foo_ref = shift;
>
> I am trying to figure out if this matters. What would
> shift care about list context? shift should still
> yield one thing an array ref??? See page 356 in
> the camel book, and page 224. (I think).
> matthewsacks1415@yahoo.com


shift() returns a scalar in either list context or scalar context so both
statements do the same thing.


John
--
use Perl;
program
fulfillment
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com