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 @
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
>
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
> @
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
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
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
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
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
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
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
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
> -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
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
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
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
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
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
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
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
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
>>
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
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
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
23 matches
Mail list logo