> The varaible number is been appended to the arrya, I want as exactly > passed....
Hmmm...Whenever you pass array AND a variable with array being first, the subroutine takes the variable and appends to array. Your signature MUST BE sub change { my ($var,@arr) = @_; blah blah.... } Make sure you pass var first,followed by array. There is no need to complicate with the array ref IMHO. regards ~A On Sat, 6 Nov 2004, Anish Kumar K. wrote: > #!/usr/bin/perl > my @array=("First","second","third"); > my $menuStr="im"; > @tempArray=change(@array,$menuStr); > foreach (@tempArray) { > print "\nElement: $_\n"; > } > > sub change > { > my (@nwt,$var)[EMAIL PROTECTED]; > print "The Varaible is $var \n\n"; > print "Arrays is @nwt \n"; > @nwt=(23,234,543); > return @nwt; > } > > Result: > > The Varaible is > Arrays is First second third im > Element: 23 > Element: 234 > Element: 543 > > The varaible number is been appended to the arrya, I want as exactly > passed.... > > Anish > > ----- Original Message ----- > From: "Edward Wijaya" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Saturday, November 06, 2004 8:52 PM > Subject: Re: how to pass array and varaible > > > > sub mysub { > > my ($var, @array) = @_; > > my @new_array = (); > > #do sth to @array or $var; > > return @new_array; > > } > > > > read - perldoc perlsub > > > > Regards, > > Edward WIJAYA > > > > > > On Sat, 6 Nov 2004 12:48:26 +0530, Anish Kumar K. > > <[EMAIL PROTECTED]> wrote: > > > > > Hi > > > > > > I want to pass a array and and a varaible to a subroutine and then some > > > processing will be done at the subtroutine and the array should be > > > returned....Please help me in trying to figure out... > > > > > > Thanks > > > Anish > > > > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > > > > > > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>