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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How do I assign & substitute in one statement?⭐
by dfaure (Chaplain) on Jun 14, 2004 at 07:16 UTC | |
Re: How do I assign & substitute in one statement?⭐
by Roy Johnson (Monsignor) on Nov 13, 2004 at 22:22 UTC | |
Re: How do I assign & substitute in one statement?
by dimar (Curate) on Nov 13, 2004 at 03:10 UTC | |
by Roy Johnson (Monsignor) on Nov 13, 2004 at 03:38 UTC | |
by Roy Johnson (Monsignor) on Nov 13, 2004 at 15:16 UTC | |
by ysth (Canon) on Nov 14, 2004 at 06:45 UTC |
Back to
Seekers of Perl Wisdom