Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy is Perl complaining about an unterminated string here?
    primarykey
    data
    text
    <p>I have a Perl script which runs fine under Perl 5.005 on HPUX 11i v3 and that causes a small problem under Perl 5.10 on my Ubuntu 11.04 box.</p> <p>It boils down to a line like:</p> <pre><code>open (CMD, "do something | grep -E 'sometext$' |"); </code></pre> <p>(it's actually capturing <code>ps -ef</code> output to see if a process is running but I don't think that's important <sup>(a)</sup>).</p> <p>Now this runs fine on the HPUX environment but, when I try it out under Ubuntu, I get:</p> <pre><code>sh: Syntax error: Unterminated quoted string </code></pre> <p>By inserting copious debug statements, I tracked it down to that offending line then started removing characters one-by-one until it stopped complaining. Luckily, <code>$</code> was the first one I tried and it stopped giving me the error, so I then changed the line to:</p> <pre><code>open (CMD, "do something | grep -E 'sometext\$' |"); </code></pre> <p>and it worked fine (under Linux anyway - I haven't tested that on HPUX since I don't have access to that machine today - if it does work, I'll just use that approach but I'd still like to know why it's a problem).</p> <p>So it seems obvious that the <code>$</code> is "swallowing" the closing single quote under my Linux environment but not apparently on the HPUX one.</p> <p>My question is simply, why? Surely there weren't any massive changes between 5.005 and 5.10. Or is there some sort of configuration item I'm missing?</p> <hr> <p><sup>(a)</sup> But, if you know a better way to do this <em>without</em> external CPAN modules (ie, with just the baseline Perl 5.005 installation), I'd be happy to know about it.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload