Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: expanding quoted referenced data

by diotalevi (Canon)
on Sep 08, 2006 at 17:56 UTC ( [id://572038]=note: print w/replies, xml ) Need Help??


in reply to expanding quoted referenced data

It sounds like you're trying to do $text = eval qq["$text"]. It's not a good idea and neither is what you said you wanted. Try using a real templating module, one that doesn't involve eval or /e.

⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

Replies are listed 'Best First'.
Re^2: expanding quoted referenced data
by nobull (Friar) on Sep 09, 2006 at 10:01 UTC
    It's not a good idea and neither is what you said you wanted.
    Granted.
    It sounds like you're trying to do $text = eval qq["$text"].
    Note: if the OP does decide to use eval() despite all the reasons not to then a heredoc is better than "" as it avoids sensativity to " characters in the data.
    chop ( $text = eval "<<_EOD_$text\n_EOD_" );

    This, of course, is stil confused by "\n_EOD_\n" in the data is still subject to all the dangers implicit in eval().

Re^2: expanding quoted referenced data
by Anonymous Monk on Sep 08, 2006 at 21:44 UTC
    Thanks for all the help. Near term, I'll use the eval to eliminate the regex. Long term, I'll learn Text::Template or some such.

    Tyson

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (6)
As of 2024-03-29 00:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found