in reply to Re: escaping the @ in an interpolating string
in thread escaping the @ in an interpolating string
@$0 is seen as @{ $0 }The issue isn't limited to $0 following the @: no matter what variable follows it—whether it exists or not—the @ is not interpreted literally.
Interestingly, sometimes the entire @$foo seems to be interpreted as a unit, printing nothing, and other times @$ seems to be interpreted as one unit, printing whatever follows it literally. In no case is the @ interpreted literally. And, of course, in all cases preceding the @ with a backslash solves that, and allows the following variable to be interpolated:$ perl -e 'print "@$$\n";' $ perl -e 'print "@$undefined_variable\n";' $ perl -e 'print "@$]\n";' ] $ perl -e 'print "@$(\n";' (
$ perl -e 'print "\@$$\n";' @24477 $ perl -e 'print "\@$undefined_variable\n";' @ $ perl -e 'print "\@$]\n";' @5.030003 $ perl -e 'print "\@$(\n";' @500 7 10 11 16 18 19 27 35 80 85 100 105 500
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: escaping the @ in an interpolating string
by Danny (Chaplain) on Aug 10, 2024 at 19:11 UTC | |
by raygun (Scribe) on Aug 10, 2024 at 19:23 UTC | |
Re^3: escaping the @ in an interpolating string
by NERDVANA (Priest) on Aug 10, 2024 at 19:42 UTC | |
Re^3: escaping the @ in an interpolating string
by japhy (Canon) on Aug 13, 2024 at 02:33 UTC | |
by raygun (Scribe) on Aug 13, 2024 at 10:00 UTC |