perl - Eliminate intermediate variable when combining here document, substitution and die -
is possible eliminate use of intermediate variable $msg
in example?
($msg = <<'end_msg') =~ s/\n//gm; super error message happens span on multiple lines want print without newlines. end_msg die $msg;
if did not need remove newlines, directly die <<'end_msg'; ...
have not found way combine these 2 approaches.
with perl 5.14 or newer can,
die <<'end_msg' super error message happens span on multiple lines want print without newlines. end_msg =~ s/\n//gr;
edit: or
die <<'end_msg' =~ s/\n//gr .. end_msg
Comments
Post a Comment