Regular expressions: Difference between revisions

Content added Content deleted
m (omissions)
Line 1,168: Line 1,168:


$string =~ s/i/u/ig; # would change "I am a string" into "u am a strung"</lang>
$string =~ s/i/u/ig; # would change "I am a string" into "u am a strung"</lang>

Omission of the regular expression binding operators

If regular expression matches are being made against the topic variable, it is possible to omit the regular expression binding operators:

$_ = "I like banana milkshake.";
if (/banana/) { # The regular expression binding operator is omitted
print "Match found\n";
}


=={{header|Perl 6}}==
=={{header|Perl 6}}==