thanks, i ended up getting what i wanted with references:
&sub1(\@array,$var); sub sub1() { my ($ref, $var) = @_; my @data = @$ref; ... } --- drieux <[EMAIL PROTECTED]> wrote: > > On Friday, Sep 13, 2002, at 16:29 US/Pacific, > Anthony E. wrote: > [..] > > for example, i tried this, but it doesn't work :-( > ... > > > > &sub1(@array,$scalar); > > > > sub sub1() { > > my (@array2, $scalar2) = @_; > > print "$scalar2\n"; > > } > > remember that @_ is an array, so the @array2 gobbles > up everything in an array to array assignment. > > So you can only pass 'one array type' - whether a > %hash > or an @array - into or out of an array. > > what you will also find a bit more efficient is to > pass > the reference to these complex data types > > my $new_array_ref = sub1(\@array, $scalar); > > sub sub1 { > my ($array_ref, $scalar_var) = @_; > print "scalar is $scalar_var \n"; > print "have item $_ \n" > for (@$array_ref); > > my @tmp = @$array_ref ; > push(@tmp, $scalar_var); > > return(\@tmp); > } > > for a bit of fun.... > > ciao > drieux > > --- > __________________________________________________ Do you Yahoo!? Yahoo! News - Today's headlines http://news.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]