http://www.perlmonks.org?node_id=366431

dfaure has asked for the wisdom of the Perl Monks concerning the following question: (strings)

Is it possible to assign a value to a variable and then do a substitution on it in a single statement? For example suppose I want to start with a URL, remove a known host-domain name, then assign the remaining dir/filename to a variable. With two statements you could say:

$dirfilename = $url; $dirfilename = s|http://foo.bar.com/||;

Originally posted as a Categorized Question.