in reply to Extracting money from a double quoted string

I have a HUGE amount of text being read into a double quoted string

How do you "read into a double quoted string"?

You can type into a double quoted string; but it would be a particularly inefficient way to deal with "a HUGE amount of text".


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re: Extracting money from a double quoted string

Replies are listed 'Best First'.
Re^2: Extracting money from a double quoted string
by ww (Archbishop) on Dec 06, 2014 at 17:11 UTC

    Does this pass a syntax, compilation and execution test? Yes.

    Does it pass as a reasonable interp of op's use of "read" and/or a sanity test? I dunno!

    #!/usr/bin/perl use strict; use warnings; use 5.018; # read_to_dblquoted_str.pl my $str=qq("); my $txt = "abcdef \$3.05 xyz"; # to minimize, assigning this way, st +ed openning a file and reading it. $str .= $txt . qq("); say "\$txt: " . $txt; say "\$str: " . $str; =head C:\> read_to_dblquoted_str.pl $txt: abcdef $3.05 xyz $str: "abcdef $3.05 xyz" =cut

      That's not "a double quoted string" it's "a string containing double quotes".

      The difference is that a double quoted string in interpreted at compile time as a part of the program.

      What you've constructed at runtime is not. It's just a scalar that contains some characters.

      (Note:when you print a double quoted string; the quotes aren't printed. Their purpose is served by the time you get to runtime.)


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

        Thanks for correction and your observation. From /me, ++, despite one misgiving:

        OP's description is sufficiently confused and confusing that it's not at all clear (until we read down to the updated reply) that he has any clue about the meaning of your distinction and -- obviously -- I failed to consider that distinction.