On Fri, Nov 14, 2003 at 11:40:51AM +0000, angie ahl wrote:
> I want to return an array and 2 scalars.
> 
> sub EventList {
>     my ($class, %arg) = @_;
>     # load of code here
>     return ([EMAIL PROTECTED], \$startdate, \$enddate);
> }
> 
> So far so good (I think)

You're actually returning references to the array and scalars,
which might not be what you wanted.
 
> but I don't seem to be able to access it. I've tried all sorts:
> 
> my $event = Event->new;
> my @tempres = $event->EventList(skip=>0, max=>10);
> my $startdate = $tempres[2];
> my $enddate = $tempres[3];

    sub foo { 
      my $x = 'x';
      my $y = 'y';
      my @z = qw(several values);

      return ($x, $y, @z);     # flatten into a list (no references)
    }

    my ($x, $y, @z) = foo();   # @z "slurps" the rest of the list

-- 
Steve

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to