|Perl Monk, Perl Meditation|
Re: verbatim, non-interpolated assignmentby Marshall (Abbot)
|on Sep 14, 2011 at 02:49 UTC||Need Help??|
Perl has a lot of quoting mechanisms...
Update: Oh, I see what is going on....
The alphabet of what is possible within the string is all possible characters. But the compiler has to know when the string starts and ends. In the program text (source code) there is no single character that definitively means: text starts and text stops, because all possible text characters can be part of the string.
There is a defined syntax to write a program literal in the source code. If you are not happy with those requirements (have to "escape" some characters), then I would make a config file and put the strings in there. Then they can be read as simply data. At the end of the day, a program statement is different than a line in a data file.
It is possible to use the HERE-DOC with a blank line terminator:
The RT @... @Starbuck... line appears verbatim, but you see even with that, we've made a special case, we stop when there is blank line. As an updated thought here...it is weird that: my $tweet2 =<<''; means stop on a blank line and I had to play around to verify what it did...<<'' does not mean "stop on no character".
There are syntax limitations when writing program code.
Update as per OP's update:
de plus: my $tweet is just a particularly pesky example so I am coding against it. In the final application I will be piping a .csv through @ARGV, so will this problem just go away? (Some of the proposed solutions make me think so.)
Yes. Writing source code is different than reading data from a file.