in reply to Re: Re: Forcing array context
in thread Forcing array context

If substr's okay, how about this kind of thing:
my $string = "This is a very long string"; foreach (0..length($string)) { if(substr($string, $_, 1) eq " ") { # Replace this position (space) with a "|" substr($string, $_, 1, "|"); } } print $string;
It kinda depends on what you're trying to do, but I think this might help. (Note that you can also replace with the empty string).

Hope it does.

jarich

Update: forgot the length. ;)