You're actually going to want to use it with a ? in there:<div><br></div><div>s/Hello.*,?/$ES/g;</div><div><br></div><div>Otherwise it's greedy and will replace everything from Hello through the last comma instead of the first comma.</div>
<div><br></div><div>~Scott<br><br><div class="gmail_quote">On Thu, Apr 28, 2011 at 9:27 AM, Richard Reina <span dir="ltr"><<a href="mailto:richard@rushlogistics.com">richard@rushlogistics.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
This worked great.<br>
<br>
Thanks!<br>
<div class="im"><br>
<br>
---- Chicago.pm chatter <<a href="mailto:chicago-talk@pm.org">chicago-talk@pm.org</a>> wrote:<br>
><br>
> Change the "Hello," to "Hello.*,", so it includes any characters between<br>
> the salutation and the comma.<br>
><br>
> Richard Reina wrote, On 4/28/2011 7:34 AM:<br>
</div><div><div></div><div class="h5">> > I have the code below that replaces the string "Hello," with a scalar $ES which consists of "Hello " . $persons_first_name ",";  It works fine.  However, what I can't figure out is how to make it also substitute a string that already has a first name after hello.  For example, if finds Hello Kim, I want it to replace it with $ES.  Sorry for my ignorance.  Any help would be greatly appreciated.<br>

> ><br>
> > Thanks,<br>
> ><br>
> > Richard<br>
> ><br>
> > sub change_salutation {<br>
> ><br>
> > my ($ES) = @_;<br>
> ><br>
> > @ARGV = qw(L_FILE);<br>
> ><br>
> > $^I="";<br>
> ><br>
> > while (<>) {<br>
> ><br>
> >     $_ =~ s/Hello,/$ES/g;<br>
> >     $print $_;<br>
> ><br>
> > }<br>
> ><br>
> > } # end of sub<br>
> ><br>
> ><br>
> > }<br>
> ><br>
> ><br>
> > }<br>
> > _______________________________________________<br>
> > Chicago-talk mailing list<br>
> > <a href="mailto:Chicago-talk@pm.org">Chicago-talk@pm.org</a><br>
> > <a href="http://mail.pm.org/mailman/listinfo/chicago-talk" target="_blank">http://mail.pm.org/mailman/listinfo/chicago-talk</a><br>
> ><br>
> _______________________________________________<br>
> Chicago-talk mailing list<br>
> <a href="mailto:Chicago-talk@pm.org">Chicago-talk@pm.org</a><br>
> <a href="http://mail.pm.org/mailman/listinfo/chicago-talk" target="_blank">http://mail.pm.org/mailman/listinfo/chicago-talk</a><br>
><br>
_______________________________________________<br>
Chicago-talk mailing list<br>
<a href="mailto:Chicago-talk@pm.org">Chicago-talk@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/chicago-talk" target="_blank">http://mail.pm.org/mailman/listinfo/chicago-talk</a><br>
</div></div></blockquote></div><br></div>