Re: passing part of an array to a function

2001-05-20 Thread David H. Adler
On Thu, May 17, 2001 at 11:33:55AM +1000, King, Jason wrote: > Peter Scott writes .. > > >At 10:44 AM 5/17/01 +1000, King, Jason wrote: > >>so here's the thing .. Perl doesn't have pointers .. only references > >>.. so you can't have a 1500 element array and grab a reference to the > >>700th elem

Re: passing part of an array to a function

2001-05-17 Thread Gary Stainburn
Thanks for that explanation Jason, I'm always happier when I know *why* something doesn't work. What I've ended up doing, and was also suggested in another branch of this thread was to pass a reference to the whole array, and a start and end index number. This appears to provide the fastest r

RE: passing part of an array to a function

2001-05-16 Thread King, Jason
Peter Scott writes .. >At 10:44 AM 5/17/01 +1000, King, Jason wrote: >>so here's the thing .. Perl doesn't have pointers .. only references >>.. so you can't have a 1500 element array and grab a reference to the >>700th element > >Oh yes you can: > >my @foo = qw(three blind mice); >my $elemref =

RE: passing part of an array to a function

2001-05-16 Thread Peter Scott
At 10:44 AM 5/17/01 +1000, King, Jason wrote: >so here's the thing .. Perl doesn't have pointers .. only references .. so >you can't have a 1500 element array and grab a reference to the 700th >element Oh yes you can: my @foo = qw(three blind mice); my $elemref = \$foo[2]; > .. because referen

RE: passing part of an array to a function

2001-05-16 Thread King, Jason
Gary wrote .. &file_control(\@lines[10..36]); # pass pointer to array elements I just wanted to add something for those that are interested in what the above actually does .. let's use an example @foo = qw/a b c d e f g h i j/; then we do this $bar = \@foo[3..6]; what it does is cr

RE: passing part of an array to a function

2001-05-16 Thread King, Jason
Gary writes .. >The whole point of using references was so that I didn't want to keep >copying array slices. This script will be handling nearly 1500 program >source files totalling almost 750k lines of code. > >Any further help would be appreciated. so here's the thing

Re: passing part of an array to a function

2001-05-16 Thread Gary Stainburn
The whole point of using references was so that I didn't want to keep copying array slices. This script will be handling nearly 1500 program source files totalling almost 750k lines of code. Any further help would be appreciated. Gary On Tuesday 15 May 2001 5:32 pm, Jos Boumans wrote: > O

Re: passing part of an array to a function

2001-05-15 Thread Jos Boumans
Ok, let's hope i can shed some light on this situation. What's going wrong is that you are using a reference to an array slice... not sure why that's a big problem but it is apparently. in your case, there are 2 solutions: 1) do something like the following if you insist on using references

Re: passing part of an array to a function

2001-05-15 Thread Paul
--- Gary Stainburn <[EMAIL PROTECTED]> wrote: > Hi all, Hi, Gary. =o) > I have an array that holds the source code to a cobol program. I > then have a number of integers that hold the subscript for section and > division changes. > I then have subs that parse sections of that array. e.g. a sub