Do the assignment and substitute thereafter:
($var2 = $var1) =~ s!/!!; [download]
The substitution above operates on $var2.
In reply to Re: perl one liner by shmem in thread perl one liner by selva