Sponsored Content
Top Forums Shell Programming and Scripting Passing a file handler and an array from Perl to Shell Script Post 302259202 by jim mcnamara on Monday 17th of November 2008 12:21:58 PM
Old 11-17-2008
test.pl
Code:
#!/usr/bin/perl -w
    use strict;
    my @array = (1, 2, 3, 4, 5, 6, 9);
    my $filename = "/path/to/myfilename";    
    my @args = ( "myshell.sh", "$filename", "@array");
    system(@args) == 0 || die;


myshell.sh
Code:
echo "the filename is $1 \c"
set -A array  $2
echo  "the array = ${array[*]}"

Code:
/home/jmcnama>  test.pl
the filename is /path/to/myfilename the array = 1 2 3 4 5 6 9

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

shell script signal handler

AIX 4.3.3 I am trying to write a signal handler into a ksh shell script. I would like to capture the SIGTERM, SIGINT, and the SIGTSTP signals, print out a message to the terminal, and continue executing the script. I have found a way to block the signals: #! /bin/ksh SIGTERM=15 SIGINT=2... (2 Replies)
Discussion started by: jalburger
2 Replies

2. Shell Programming and Scripting

Passing value from shell script to .pls file

I have a shell script which takes at the command prompt options like ss1.sh -F SCOTT -T JOHN F- From User T- To User I want to pass the From User(SCOTT) Value to another script ss2.pls (This script runs a PL/SQL Program). Depending on the FromUser value in the ss1.sh script i have to... (4 Replies)
Discussion started by: dreams5617
4 Replies

3. Shell Programming and Scripting

Need help passing variables in shell script to perl one-liner

I'm writing a script to automate some post-install tasks on RHEL4 servers. I need the following code to insert an 'A' in the middle of a string, then replace the string in a file. I know I can use sed to do this, but I'd like to use perl's in place edit so I don't have to write to a temp file,... (1 Reply)
Discussion started by: Xek
1 Replies

4. Shell Programming and Scripting

Passing parameter from one file to shell script

Hi All, I have a 2 files. File1 i am generating using an ETL tool, which is a comman seperated delimited file which contains country code & load date. everytime, this country code will be updated from a table. It might be AB or BA & ld_date will be for which date we need to load the file. ... (7 Replies)
Discussion started by: Amit.Sagpariya
7 Replies

5. Shell Programming and Scripting

Perl Function Array Arguement Passing

Hi All, I have some questions regarding array arguements passing for Perl Function. If @array contains 2 items , arguements passing would be like Code_A. But what if @array needs to add in more items, the rest of the code like $_ will have to be modified as well (highlighted in red), which is... (5 Replies)
Discussion started by: Raynon
5 Replies

6. Shell Programming and Scripting

Can we pass an array of strings from a Perl Program to a Shell Script?

Hi Folks, The subject is my question: Can we pass an array of strings from a Perl Program to a Shell Script? Please provide some sample code. Thanks ---------- Post updated at 11:52 PM ---------- Previous update was at 11:43 PM ---------- I got it. Its here:... (0 Replies)
Discussion started by: som.nitk
0 Replies

7. Shell Programming and Scripting

HELP on Perl array / sorting - trying to convert Korn Shell Script to Perl

Hi all, Not sure if this should be in the programming forum, but I believe it will get more response under the Shell Programming and Scripting FORUM. Am trying to write a customized df script in Perl and need some help with regards to using arrays and file handlers. At the moment am... (3 Replies)
Discussion started by: newbie_01
3 Replies

8. Shell Programming and Scripting

Passing Shell array to SQLPlus

Dears, Newbie here and tried to search this topic for 3 days now with results. I have a shell array and I want to use it in sqlplus with one connection. here is what I have for now #!/bin/ksh FileName=1000 FileName=2000 FileName=3000 FileName=4000 sqlplus /nolog <<EOF connect... (20 Replies)
Discussion started by: roby2411
20 Replies

9. Shell Programming and Scripting

Passing PERL var values to SH Shell Script

Greetings all, If I have a SH script that calls a PERL script in the following way: perl $HOME/scripts/config.properties And in the config.properties PERL file, this Perl script only sets a number of environmental parameters in the following way: #!/usr/bin/perl $VAR1 = ( ... (3 Replies)
Discussion started by: gikyo12
3 Replies

10. Shell Programming and Scripting

Passing values to an XML file from shell script

:wall: Hi, I have an XML file with 5 tags. I need to pass values to the XML file from a shell script that will replace values in 2 of the tags. I cannot hardcode the tag values in XML and use replace command in script as the values are likely to change. Please help !!!!!!!!!!! (2 Replies)
Discussion started by: Monalisaa
2 Replies
FORWARD_STATIC_CALL(3)							 1						    FORWARD_STATIC_CALL(3)

forward_static_call - Call a static method

SYNOPSIS
mixed forward_static_call (callable $function, [mixed $parameter], [mixed $...]) DESCRIPTION
Calls a user defined function or method given by the $function parameter, with the following arguments. This function must be called within a method context, it can't be used outside a class. It uses the late static binding. PARAMETERS
o $function - The function or method to be called. This parameter may be an array, with the name of the class, and the method, or a string, with a function name. o $parameter - Zero or more parameters to be passed to the function. RETURN VALUES
Returns the function result, or FALSE on error. EXAMPLES
Example #1 forward_static_call(3) example <?php class A { const NAME = 'A'; public static function test() { $args = func_get_args(); echo static::NAME, " ".join(',', $args)." "; } } class B extends A { const NAME = 'B'; public static function test() { echo self::NAME, " "; forward_static_call(array('A', 'test'), 'more', 'args'); forward_static_call( 'test', 'other', 'args'); } } B::test('foo'); function test() { $args = func_get_args(); echo "C ".join(',', $args)." "; } ?> The above example will output: B B more,args C other,args SEE ALSO
forward_static_call_array(3), call_user_func_array(3), call_user_func(3), is_callable(3), information about the callback type. PHP Documentation Group FORWARD_STATIC_CALL(3)
All times are GMT -4. The time now is 01:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy