Re: passing an array to subroutines

2006-07-21 Thread Mumia W.
On 07/21/2006 03:14 PM, [EMAIL PROTECTED] wrote: How do I pass an array to a subroutine in a manner that the array is entirely contained in one element of @_, instead of having each element mapped to elements of @_. for example, inside of the subroutine, I'd like to say @z = @_[0]; and have @

Re: passing an array to subroutines

2006-07-21 Thread Xavier Mas i Ramón
A Divendres 21 Juliol 2006 22:14, [EMAIL PROTECTED] va escriure: > How do I pass an array to a subroutine in a manner that the array is > entirely contained in one element of @_, instead of having each element > mapped to elements of @_. > > for example, inside of the subroutine, I'd like to say >

Re: passing an array to subroutines

2006-07-21 Thread Joshua Colson
On Fri, 2006-07-21 at 16:14 -0400, [EMAIL PROTECTED] wrote: > How do I pass an array to a subroutine in a manner that the array is entirely > contained in one element of @_, instead of having each element mapped to > elements of @_. > > for example, inside of the subroutine, I'd like to say > @

RE: passing an array

2003-12-10 Thread Bob Showalter
Mike Blezien wrote: > Hello, > > what is the best way to pass an array to a sub routine, IE. You can't pass an array to a sub. You can only pass a list of scalars. > > my @fields = qw(one two three); > > send_array(@fields); > > > sub send_array { >my @ary = @_; Whatever you passed ends

Re: passing an array

2003-12-09 Thread Mike Blezien
Thanks James, passing as a reference was basically what I was trying to recall, your example made that clear :) -- MikeBlezien =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Thunder Rain Internet Publishing Providing Internet Solutions that work! =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= James Edwa

Re: passing an array

2003-12-09 Thread James Edward Gray II
On Dec 9, 2003, at 8:49 PM, Mike Blezien wrote: Hello, what is the best way to pass an array to a sub routine, IE. my @fields = qw(one two three); send_array(@fields); sub send_array { my @ary = @_; # do stuff here } is this the most effective way to pass an array to sub routine or is t

Re: Passing an array to a subroutine

2003-06-25 Thread John W. Krahn
Dermot Paikkos wrote: > > Hi gurus, Hello, > I have a script that is causing me some trouble. I haven't pasted the whole script > here > as it is a bit long and I can't submit any test data. > > Basically the script copies and renames file. At the end I would like to print out a > report of al

Re: Passing an array to a subroutine

2003-06-25 Thread Jenda Krynicky
From: "Dermot Paikkos" <[EMAIL PROTECTED]> > At the start I glob a directory for tif files and these are added to > the @tiffs array. Later a subroutine loops through the array and > prints the file names into the user's log. However I only get the > first file name from the file glob, all the othe

Re: Passing an array to a subroutine

2003-02-11 Thread John W. Krahn
Colin Johnstone wrote: > > Gidday All, Hello, > A couple of you helped me with this before but I have misplaced my notes I am > trying to pass an array to a subroutine and am having trouble. > > As i am passing other variables as well I know I need to pass it by reference. > Am I doing it corre

RE: Passing an array to a subroutine

2003-02-11 Thread Hanson, Rob
I think you forgot to dereference it... $pageContent = format_indexPage( \@picDetails, 0 ); sub format_indexPage{ my ( $paramArrayPicDetails, $paramIndexPageId ) = @_; --> my @paramArrayPicDetails = @{$paramArrayPicDetails}; ... $numElements = scalar( @paramArrayPicDetails ); Rob

RE: Passing an array to a subroutine

2002-11-26 Thread Johnstone, Colin
Thank you Wiggins, and thankyou also for your help with scoping yesterday. Colin -Original Message- From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 27, 2002 13:08 To: Johnstone, Colin Cc: '[EMAIL PROTECTED]' Subject: Re: Passing an array

RE: Passing an array to a subroutine

2002-11-26 Thread Toby Stuart
> -Original Message- > From: Johnstone, Colin [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, November 27, 2002 2:31 PM > To: '[EMAIL PROTECTED]' > Subject: Passing an array to a subroutine > > > Hi all, > > I think somebody asked this the other day. > > How does one pass an array to

Re: Passing an array to a subroutine

2002-11-26 Thread Wiggins d'Anconia
If it is just an array and nothing else gets passed, then you can pass it normally... my $return = passArrayToMe(@array) and your definition will go something like this: sub passArrayToMe { my @array = @_; } but if you need to pass other variables as well then you will need to pass an array

Re: passing an array and a hash to a subroutine.

2002-11-21 Thread John W. Krahn
David Buddrige wrote: > > Hi all, Hello, > I want to write a subroutine that takes an array and a hash as input > parameters and then does some work on them. I can't seem to determine > how to do this however; it seems that with a subroutine, all you can > pass is a single array ( which appears

Re: passing an array and a hash to a subroutine.

2002-11-21 Thread Sudarshan Raghavan
On Thu, 21 Nov 2002, David Buddrige wrote: > > Hi all, > > I am writing a subroutine which is intended to take an array of strings, > and concatenate each string in the array into a single [very long] string. > > > The subroutine is listed below. > > My problem is that for some reason when I

RE: passing an array and a hash to a subroutine.

2002-11-21 Thread Timothy Johnson
foreach(sort keys %{$hRef}){ print " $_ => $hRef->{$_}\n"; } print "\$scalar = \"$scalar\"\n"; } ############ -Original Message- From: David Buddrige To: [EMAIL PROTECTED] Sent: 11/20/02 10:32 PM Subject: Re: passi

Re: passing an array and a hash to a subroutine.

2002-11-20 Thread David Buddrige
Hi all, I have figured out the solution to the problem below is to use an array of references to the various objects that I want to pass into the subroutine. thanks guys David. David Buddrige wrote: Hi all, I want to write a subroutine that takes an array and a hash as input parameters and

Re: passing an array and a hash to a subroutine.

2002-11-20 Thread David Buddrige
Hi all, I am writing a subroutine which is intended to take an array of strings, and concatenate each string in the array into a single [very long] string. The subroutine is listed below. My problem is that for some reason when I print out the variable "$single_comment_line", rather than get

Re: Passing an array from a 2-D array

2002-02-18 Thread Michael Fowler
On Sat, Feb 16, 2002 at 11:20:42AM -0500, Ian P. Thomas wrote: > If I read this correctly, I takes the first array from > unchecked_dfa_states and passes it out, but not before dereferencing > it. I needed something that could take the first array as a whole > object and pass it to check

Re: Passing an array from a 2-D array

2002-02-16 Thread Ian P . Thomas
On Thursday, February 14, 2002, at 08:12 PM, Michael Fowler wrote: > On Thu, Feb 14, 2002 at 04:14:39PM -0500, Ian P. Thomas wrote: >> >> # The array, unchecked_dfa_states, is going to be an array of arrays >> ( 2-D ). >> # dfa_state_creation is a subroutine that returns an array, and takes >>

Re: Passing an array from a 2-D array

2002-02-14 Thread Michael Fowler
On Thu, Feb 14, 2002 at 04:14:39PM -0500, Ian P. Thomas wrote: > > # The array, unchecked_dfa_states, is going to be an array of arrays ( 2-D ). > # dfa_state_creation is a subroutine that returns an array, and takes an array > # or single number, and a scalar, as parameters. > push @unchecked_d

Re: passing an array ref by environment variables

2001-07-16 Thread Ondrej Par
On Saturday 14 July 2001 22:18, Jeff 'japhy' Pinyan wrote: > > # prog1 > use Data::Dumper; > $ENV{ARRAY} = Dumper \@array; > > # prog2 > @array = @{ eval $ENV{ARRAY} }; > I would be really careful with that axe :) evaluating anything that you get from enviroment variable is a security

Re: passing an array ref by environment variables

2001-07-14 Thread Jeff 'japhy' Pinyan
On Jul 14, P. Schaub said: >is it possible to pass an array referenz >by an environment variable to another perl script ? No. The environment is not magical like that -- the place in memory of the reference in program A is not special to program B. You'll have to send a serialized version som