Sponsored Content
Top Forums Shell Programming and Scripting Perl Function Array Arguement Passing Post 302301480 by Raynon on Friday 27th of March 2009 02:31:05 AM
Old 03-27-2009
Hi KevinDAC,

Thanks for the advice, but what's the below code trying to do ?
And what does @_ represent ?
And what if there are 2 array list ? Which method would be better ?

Code:
my ($w, $h, $d,@t) = @_;

 

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
ExtUtils::XSpp::Node::Function(3pm)			User Contributed Perl Documentation		       ExtUtils::XSpp::Node::Function(3pm)

NAME
ExtUtils::XSpp::Node::Function - Node representing a function DESCRIPTION
An ExtUtils::XSpp::Node subclass representing a single function declaration such as int foo(); More importantly, ExtUtils::XSpp::Node::Method inherits from this class, so all in here equally applies to method nodes. METHODS
new Creates a new "ExtUtils::XSpp::Node::Function". Named parameters: "cpp_name" indicating the C++ name of the function, "perl_name" indicating the Perl name of the function (defaults to the same as "cpp_name"), "arguments" can be a reference to an array of "ExtUtils::XSpp::Node::Argument" objects and finally "ret_type" indicates the (C++) return type of the function. Additionally, there are several optional decorators for a function declaration (see ExtUtils::XSpp for a list). These can be passed to the constructor as "code", "cleanup", "postcall", and "catch". "catch" is special in that it must be a reference to an array of class names. resolve_typemaps Fetches the ExtUtils::XSpp::Typemap object for the return type and the arguments from the typemap registry and stores a reference to those objects. resolve_exceptions Fetches the ExtUtils::XSpp::Exception object for the %catch directives associated with this function. add_exception_handlers Adds a list of exception names to the list of exception handlers. This is mainly called by a class' "add_methods" method. If the function is hard-wired to have no exception handlers, any extra handlers from the class are ignored. print_declaration Returns a string with a C++ method declaration for the node. perl_function_name Returns the name of the Perl function to generate. is_method Returns whether the object at hand is a method. Hard-wired to be false for "ExtUtils::XSpp::Node::Function" object, but overridden in the ExtUtils::XSpp::Node::Method sub-class. has_argument_with_length Returns true if the function has any argument that uses the XS length feature. ACCESSORS
cpp_name Returns the C++ name of the function. perl_name Returns the Perl name of the function (defaults to same as C++). set_perl_name Sets the Perl name of the function. arguments Returns the internal array reference of ExtUtils::XSpp::Node::Argument objects that represent the function arguments. ret_type Returns the C++ return type. code Returns the %code decorator if any. set_code Sets the implementation for the method call (equivalent to using %code); takes the code as an array reference containing the lines. cleanup Returns the %cleanup decorator if any. postcall Returns the %postcall decorator if any. catch Returns the set of exception types that were associated with the function via %catch. (array reference) set_static Sets the "static"-ness attribute of the function. Can be either undef (i.e. not static), "package_static", or "class_static". package_static Returns whether the function is package static. A package static function can be invoked as: My::Package::Function( ... ); class_static Returns whether the function is class static. A class static function can be invoked as: My::Package->Function( ... ); perl v5.14.2 2011-12-20 ExtUtils::XSpp::Node::Function(3pm)
All times are GMT -4. The time now is 08:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy