You probably want to use "map".

This should work.

@body = map { s/foo/bar/; $_ } (@body);

Rob

-----Original Message-----
From: Lysander [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 04, 2002 1:17 PM
To: [EMAIL PROTECTED]
Subject: Using =~ with a list


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]

Reply via email to