Mega Code Archive

 
Categories / Perl / Regular Expression
 

Substitute first occurrence of blue with red

$str = "gree, red, blue, blue, blue..."; $str =~ s/blue/red/;   print $str;