Sponsored Content
Top Forums Shell Programming and Scripting Perl Function Array Arguement Passing Post 302301639 by KevinADC on Friday 27th of March 2009 01:29:42 PM
Old 03-27-2009
Quote:
Originally Posted by pludi
@_ is the automagically created array containing all calling parameters (the array that you use when you access $_[x]). And if there's more than one array to pass around, refs are definitely the way to go, unless you have some other way to discern one array from the other.
I agree with pludi. If you have more than one array, or even really just one array, use references as I showed in my other post. As far as @_ goes, he explained it well enough so I will leave it at that.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[BASH - KSH] Passing array to a function

Passing a array to a function, a basic feature in modern language, seems to be only possible in KSH. Not in BASH. Depite all my efforts I couldn't come to a solution. See the following examples: It works perfectly in KSH: #!/usr/bin/ksh function print_array { # assign array by indirect... (3 Replies)
Discussion started by: ripat
3 Replies

2. Shell Programming and Scripting

Passing global variable to a function which is called by another function

Hi , I have three funcions f1, f2 and f3 . f1 calls f2 and f2 calls f3 . I have a global variable "period" which i want to pass to f3 . Can i pass the variable directly in the definition of f3 ? Pls help . sars (4 Replies)
Discussion started by: sars
4 Replies

3. Shell Programming and Scripting

Passing a file handler and an array from Perl to Shell Script

Hi there, I am trying to call a shell script from a Perl script. here is the code: @args = ("sh", "someshellprg.sh", "a file handler", "an array"); system(@args) == 0 or die "system @args failed: $?"; in the shell program, I examine if the arguments exits using: if then echo... (5 Replies)
Discussion started by: pinkgladiator
5 Replies

4. UNIX for Dummies Questions & Answers

How to pass array as an arguement ?

Hi experts, I am here again with another Issue. I need to pass the array as parameter / argument to another script. I tried it as follows . ( I got this idea from the link ) $ cat test1.sh #! /usr/bin/ksh set -a arr1 echo "...In Test1...." arr1="APPS_DEV" arr1="TEST_DEV" echo... (16 Replies)
Discussion started by: rajavu
16 Replies

5. Shell Programming and Scripting

Passing arguments to Perl Function

Hi All, I am trying to pass an argument called "Pricelist" to a Perl function, then the function will open and print out the contents of the file named "Pricelist". But i can't seem to do it using my below code. Can any expert give some advice? #!/usr/local/bin/perl $DATABASE =... (1 Reply)
Discussion started by: Raynon
1 Replies

6. Shell Programming and Scripting

[bash] passing array to function

Hi, I'm trying to write a function that reassigns an array to another local array but the method used in reassigning the array reformats the contents of the array which is what I am trying to prevent. The method used to load a file into an array works as expected and the entire array is... (4 Replies)
Discussion started by: ASGR
4 Replies

7. Programming

Passing two dimensional array to a function

Hi. I have a problem with passing two dimensional array to a function. First, let me show my code to explain what i am going to do: I have function:void initialize_board(char board);which is supposed to modify content of passed array. I have read here: Question 6.18 how such arrays should be... (3 Replies)
Discussion started by: Shang
3 Replies

8. Programming

[solved]help passing array of structs to function in c

this is my code to try and prinnt out a deck of cards. the print function worked when used inside main without being a function but now i cant get it to work as a function probably since i dont know how to pass a struct array in c. I gave it a shot but i keep getting an assortment of errors. The... (0 Replies)
Discussion started by: bjhum33
0 Replies

9. Shell Programming and Scripting

Problem in passing date to external function from perl script.

my $sysdate = strftime('%Y-%m-%d', localtime ); biDeriveByDate('Table_Str',$sysdate,\@lIndx,\@lResVals) In a perl script, when I'm trying to pass $sysdate to some external function it's not working since $sysdate is passed as a string mentioned above but my function is expecting a date value... (1 Reply)
Discussion started by: Devesh5683
1 Replies

10. Shell Programming and Scripting

Passing variable value in a function to be used by another function

Hello All, I would like to ask help from you on how to pass variable value from a function that has been called inside the function. I have created below and put the variables in " ". Is there another way I can do this? Thank you in advance. readtasklist() { while read -r mod ver... (1 Reply)
Discussion started by: aderamos12
1 Replies
Bio::Matrix::MatrixI(3pm)				User Contributed Perl Documentation				 Bio::Matrix::MatrixI(3pm)

NAME
Bio::Matrix::MatrixI - An interface for describing a Matrix SYNOPSIS
# Get a Matrix object DESCRIPTION
This is an interface describing how one should be able to interact with a matrix. One can have a lot of information I suppose and this outline won't really work for PWM or PSSMs. We will have to derive a particular interface for those. FEEDBACK
Mailing Lists User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to the Bioperl mailing list. Your participation is much appreciated. bioperl-l@bioperl.org - General discussion http://bioperl.org/wiki/Mailing_lists - About the mailing lists Support Please direct usage questions or support issues to the mailing list: bioperl-l@bioperl.org rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible. Reporting Bugs Report bugs to the Bioperl bug tracking system to help us keep track of the bugs and their resolution. Bug reports can be submitted via email or the web: https://redmine.open-bio.org/projects/bioperl/ AUTHOR - Jason Stajich Email jason-at-bioperl.org APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ matrix_id Title : matrix_id Usage : my $id = $matrix->matrix_id Function: Get the matrix ID Returns : string value Args : matrix_name Title : matrix_name Usage : my $name = $matrix->matrix_name(); Function: Get the matrix name Returns : string value Args : get_entry Title : get_entry Usage : my $entry = $matrix->get_entry($rowname,$columname) Function: Get the entry for a given row,column pair Returns : scalar Args : $row name $column name get_column Title : get_column Usage : my @row = $matrix->get_column('ALPHA'); Function: Get a particular column Returns : Array (in array context) or arrayref (in scalar context) of values Args : name of the column get_row Title : get_row Usage : my @row = $matrix->get_row('ALPHA'); Function: Get a particular row Returns : Array (in array context) or arrayref (in scalar context) of values Args : name of the row get_diagonal Title : get_diagonal Usage : my @diagonal = $matrix->get_diagonal; Function: Get the diagonal of the matrix Returns : Array (in array context) or arrayref (in scalar context) Args : none column_num_for_name Title : column_num_for_name Usage : my $num = $matrix->column_num_for_name($name) Function: Gets the column number for a particular column name Returns : integer Args : string row_num_for_name Title : row_num_for_name Usage : my $num = $matrix->row_num_for_name($name) Function: Gets the row number for a particular row name Returns : integer Args : string num_rows Title : num_rows Usage : my $rowcount = $matrix->num_rows; Function: Get the number of rows Returns : integer Args : none num_columns Title : num_columns Usage : my $colcount = $matrix->num_columns Function: Get the number of columns Returns : integer Args : none reverse Title : reverse Usage : my $matrix = $matrix->reverse Function: Get the reverse of a matrix Returns : Args : row_names Title : row_names Usage : my @rows = $matrix->row_names Function: The names of all the rows Returns : array in array context, arrayref in scalar context Args : none column_names Title : column_names Usage : my @columns = $matrix->column_names Function: The names of all the columns Returns : array in array context, arrayref in scalar context Args : none perl v5.14.2 2012-03-02 Bio::Matrix::MatrixI(3pm)
All times are GMT -4. The time now is 11:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy