Perl replace substring vom varaible

Code examples

2
0

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";

In other languages

This page is in other languages

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................