Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: variables /interpolations inside PPI::Token::Quote::Double quoted string

by Cow1337killr (Monk)
on Sep 06, 2016 at 03:54 UTC ( #1171226=note: print w/replies, xml ) Need Help??


in reply to variables /interpolations inside PPI::Token::Quote::Double quoted string

The input:

my $foo = $bar; print "hi $foo\n"; print 'hi ', $foo, "\n";

...stored in very-easy-print-interpolation2.pl

Run, thusly:

ppi_dumper very-easy-print-interpolation2.pl

ppi_dumper is in App-PPI-Dumper.

The output:

PPI::Document PPI::Statement::Variable PPI::Token::Word 'my' PPI::Token::Whitespace ' ' PPI::Token::Symbol '$foo' PPI::Token::Whitespace ' ' PPI::Token::Operator '=' PPI::Token::Whitespace ' ' PPI::Token::Symbol '$bar' PPI::Token::Structure ';' PPI::Token::Whitespace '\n' PPI::Statement PPI::Token::Word 'print' PPI::Token::Whitespace ' ' PPI::Token::Quote::Double '"hi $foo\n"' PPI::Token::Structure ';' PPI::Token::Whitespace '\n' PPI::Statement PPI::Token::Word 'print' PPI::Token::Whitespace ' ' PPI::Token::Quote::Single ''hi '' PPI::Token::Operator ',' PPI::Token::Whitespace ' ' PPI::Token::Symbol '$foo' PPI::Token::Operator ',' PPI::Token::Whitespace ' ' PPI::Token::Quote::Double '"\n"' PPI::Token::Structure ';'

This demonstrates that PPI does not handle interpolation in a print statement very well, but a print statement with a list does work.

Replies are listed 'Best First'.
Re^2: variables /interpolations inside PPI::Token::Quote::Double quoted string
by Anonymous Monk on Sep 06, 2016 at 06:55 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1171226]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2022-01-24 13:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (64 votes). Check out past polls.

    Notices?