[Chicago-talk] Regex question

Richard Reina richard at rushlogistics.com
Thu Apr 28 05:34:34 PDT 2011


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.

Thanks,

Richard

sub change_salutation {

my ($ES) = @_;

@ARGV = qw(L_FILE);

$^I="";

while (<>) {

   $_ =~ s/Hello,/$ES/g;
   $print $_;

}

} # end of sub


}


}


More information about the Chicago-talk mailing list