hi,
use a for loop to traverse the list...
for ($i=0;$i<$#body;$i++){
$body=$body[$i];
$body =~ s/foo/bar/;
$body[$i]=$body; # 2
}
this will also change the contents of the list....if u dont want
it...comment statement marked 2.
hope this solves u r query........
regs,
sachin balsekar.
Lysander wrote:
>I need to replace all the occurances of one thing with another. This is simple
>enough, except that I am working with a list variable, rather than a scalar.
>
>@body =~ s/foo/bar/;
>
>give an error and
>
> for my $body (@body)
> {
> $body =~ s/foo/bar/;
> }
>
>appears to leave @body empty.
>
>How does one go about this?
>
>Thanks
>Sheridan Saint-Michel
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]