develooper Front page | perl.perl6.language | Postings from April 2002

Re: named params, @_, and pass-by-reference

Thread Previous | Thread Next
From:
Damian Conway
Date:
April 19, 2002 15:04
Subject:
Re: named params, @_, and pass-by-reference
Message ID:
3CC09434.576460A9@conway.org
Trey Harris wrote:
> 
> In a message dated Wed, 17 Apr 2002, Dave Storrs writes:
> >       sub load_data ( \$filename; $version; @_ ) {
> 
> I think you can do exactly this with
>         sub load_data ( $filename is rw, $version, @_ ) {
> 
> Yes?  Or maybe
>         sub load_data ( $filename is rw, $version, *@_) {
> 
> to make sure @_ gets flattened?

Exactly so. The first version expects a single array (or array ref)
as its third argument; the second version expects a list (which it
flattens, then slurps) as its third argument.

Damian

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About