Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: verbatim, non-interpolated assignment

by chromatic (Archbishop)
on Sep 13, 2011 at 23:33 UTC ( #925785=note: print w/replies, xml ) Need Help??


in reply to verbatim, non-interpolated assignment

That interpolates @peteyorn as an array.

In which version of Perl? I get an error with 5.14 as I expect, because the single-quote in It's looks like the end of string quote marker.

Is there a way to really, truly, literally, verbatim assign what's enclosed, no questions asked and no thoughts thunk on perl's part?

No. That's a semi-predicate problem and is unsolveable. You can read text via IO though.


Improve your skills with Modern Perl: the free book.

Replies are listed 'Best First'.
Re^2: verbatim, non-interpolated assignment
by toro (Beadle) on Sep 14, 2011 at 03:30 UTC
    It's

    Oh. That was foolish of me not to notice. Thank you.

    That's a semi-predicate problem and is unsolveable.

    What is semi-predicate? It sounds theoretical.

    In which version of Perl?

    This is perl, v5.10.1 (*) built for i486-linux-gnu-thread-multi

    You can read text via IO though.

    Is that what onelesd is talking about? Is it in man perlio?

      What is semi-predicate? It sounds theoretical.

      What is google? semi-predicate -> http://en.wikipedia.org/wiki/Semipredicate_problem

      Simply it means return undef to signal failure, but it can return undef as valid value, so you can't differentiate between failure or just a valid value

      It applies here because perl expects perl syntax, so you can't inline arbitrary text verbatim as part of a perl program, it could be a perl program, so you have to quote/escape, like

      my $asCloseAsYouCanGet = <<'__TO_VERBATIM__'; other stuff not that is not __TO_VERBATIM__ on a single line __TO_VERBATIM__

      The text in $asCloseAsYouCanGet cannot contain __TO_VERBATIM__ on a single line as input, because __TO_VERBATIM__ on a single line is like the closing quote, it signals the end of the input, so it can't be valid input

      In other words, the semi-predicate problem, it can't be both valid input and closing quote, it has to be one or the other, not both

      Its like pictorial depictions of numbers, the symbol for the number one, 1, cannot be the same symbol for the number two, 1 , because you cannot tell when it means one or it means two

      1 + 1 + 1 = 4? See the first 1 is really one, the second 1 is really two, and the last one is really 1 , which adds up to four

      :)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2019-02-16 13:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I use postfix dereferencing ...









    Results (95 votes). Check out past polls.

    Notices?