Horje
perl replace substring Code Example
perl replace substring
# For Perl (language) only

# syntax (NOTE: this overwrites your original string)
<variable> =~ s/<substring-to-replace>/<replacing-substring>/g;

# example: replacing all the 'r' characters with 'l'
$YourVar =~ s/r/l/g;

# usable example
my $YourVar = "strawberry";
$YourVar =~ s/r/l/g;
print $YourVar; 
print "\n";




14

Related
perl print @INC Code Example perl print @INC Code Example
perl http request Code Example perl http request Code Example
perl access elements of an array Code Example perl access elements of an array Code Example
perl compare strings Code Example perl compare strings Code Example
perl match pattern Code Example perl match pattern Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11