Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
and I want to set the char to one(1) if I have the need to hold that positionmy @p; my @pos = qw(1 2 3 4); foreach (@pos) { $p[$_] = '0' x 128; }
Thats fine but I need to test if the nums are already set to '1' so I move to a different string that's not set yet i.e., I don't want to clobber an existing range that has a placeholder. That's where I'm stuck. How to test a range of chars in a string to see if the value is '1'. I don't know why I'm stuck. Does this question make sense? Thanks.my @ranges = qw(1..4 5..8 9..12 13..16 1..8 9..16 ) foreach my $range ( @ranges ) { foreach($range){ substr($str1,$_,1) = '1'; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: strings as placeholders
by runrig (Abbot) on Nov 15, 2001 at 02:07 UTC | |
|
Re: strings as placeholders
by kwoff (Friar) on Nov 15, 2001 at 02:11 UTC | |
by Anonymous Monk on Nov 15, 2001 at 03:00 UTC | |
by kwoff (Friar) on Nov 16, 2001 at 04:20 UTC |