in reply to
Same problem replacing array index numbers
Multiple problems here.
$OldVariable
contains characters special to the regexp engine -- prepend with
\Q
.
The random number may be repeated.
Once you've modified
$code
,
@code
isn't updated.
Your code doesn't deal with multiple arrays on a line.
The sigil for (scalar) array access is
$
, not
@
.
You aren't modifying any arrays that aren't indexed (for instance, your code leaves
my @array
untouched).
You're assuming there's no space between the array name and the index.
You're assuming the index consists of just a number, what if it's an expression, a variable, or has whitespace?
You're missing all the arrays containing capital letters, or that start with an underscore.
Comment on
Re: Same problem replacing array index numbers
Select
or
Download
Code
Replies are listed 'Best First'.
Re^2: Same problem replacing array index numbers
by
astroid96
(Initiate)
on Apr 11, 2012 at 15:03 UTC
i'm aware of some of these problem thats where i need help :) all of the assumptions are people i will be the person who makes the files that are to be modified its for personal use.:) thanks
[reply]
In Section
Seekers of Perl Wisdom