Is there a way to do this in one line?
my $b = &fetch();
$b =~ s/find/replace/g;
&job($b)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Sure, with a
do {}block:The reason being that in Perl you cannot do
fetch() =~ s/find/replace/;:Can't modify non-lvalue subroutine call in substitution (s///) at ...Perl 5.14 will introduce the
/rflag (which makes the regex return the string with substitutions rather than the number of substitutions) and will reduce the above to:edited thanks to FM: can shorten the above to:
And once Perl 5.14 will be out it can be shortened to: