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 .. Perl doesn't have pointers .. only references .. so
you can't have a 1500 element array and grab a reference to the 700th
element .. because references don't work that way .. pointers work that way
- but there aint no pointers in Perl
so .. you have two choices
1. copy the elements that you want into a new memory location and send a
reference to that memory location into your subroutine (clearly non-ideal)
2. send the reference to the entire array into your subroutine and just work
with it .. you would also probably want to pass in the start index and end
index (or length if that's more helpful) .. eg.
sub file_control
{
my( $line, $start, $end) = @_;
for my $index ( $start..$end) # process each line in array section
{
# assign line to a localised $_ for convenience
local $_ = $line->[$index];
next if (/^ [\/\*]/);
# ... etc.
}
}
--
jason king
It is illegal to "annoy a bird" in any city park of Honolulu, Hawaii.
- http://dumblaws.com/