Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
$var1 = $var; # prevent original
$var1 =~ s/.*\///;
print "$var1\n";
[u] DB<1> [/u]$var='abc/123/def';
[u] DB<2> [/u]print $var=~m,.*/(.*),;
def
[u] DB<3> [/u]print $var=~m,.*?/(.*),;
123/def
[u] DB<4> [/u]print $var=~m,(.*?)/,;
abc
[u] DB<5> [/u]print $var=~m,(.*)/,;
abc/123
Unlike in C, the scalar assignment operator produces a valid lvalue.
Modifying an assignment is equivalent to doing the assignment and then
modifying the variable that was assigned to. This is useful for
modifying a copy of something, like this:
($tmp = $global) =~ tr [A-Z] [a-z];
( $var1 = $var ) =~ s/.*\///;
print "$var1\n";