"Passing Data" Please respond to the following:

label Computer Science
account_circle Unassigned
schedule 1 Day
account_balance_wallet $5

  • Give an example of how you could send data to a subroutine. Do you expect the data to change or remain the same?
Jun 8th, 2015

Thank you for the opportunity to help you with your question!

There are several ways to do it (like most things in Perl). I personally do it like this:

sub mySubroutine


      #get passed arguments

       my($name, $age, $reflist) = @_;

       #get the array from the reference

            my @list=@{$reflist} ;

            #good to go


#you need to pass @list as reference so you put \@list , which is the reference  to the array

mySubroutine($name, $age, \@list) ;

This example is to pass the following variables to subroutine mySubroutine, $name, $age and then this multidimensional array:


$list[0][0]="TEST NAME 2";
$list[0][1]="TEST GROUP 2";

$[1][0]="TEST NAME 2";
$[1][1]="TEST GROUP 2";
The data would be change after the passing  the data to the subroutine accroding to the data that is passed.

Please let me know if you need any clarification. I'm always happy to answer your questions.
Jun 13th, 2015

Did you know? You can earn $20 for every friend you invite to Studypool!
Click here to
Refer a Friend
Jun 8th, 2015
Jun 8th, 2015
Sep 20th, 2017
Mark as Final Answer
Unmark as Final Answer
Final Answer

Secure Information

Content will be erased after question is completed.

Final Answer