Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Yep! That's the entire output. I've added a couple of print $]; statements, one in an END{} block, to these to show that I get some output, which means that STDOUT must be being flushed, which I assume is a clean-up time operation:

P:\test>perl -l END{ print $] } print $]; use strict; use warnings; my $x=""; foo( substr($x,2,1) ); # crashes here print "Alive!\n"; # not reached sub foo {} ^Z 5.008004 substr outside of string at - line 6. 5.008004 P:\test>c:\perl561\bin\perl5.6.1.exe -l END{ print $] } print $]; use strict; use warnings; my $x=""; foo( substr($x,2,1) ); # crashes here print "Alive!\n"; # not reached sub foo {} ^Z 5.006001 substr outside of string at - line 6. 5.006001 P:\test>

However, if I remove the subcall from the picture:

P:\test>perl use strict; use warnings; my $x=""; print substr($x,2,1); # crashes here print "Alive!\n"; # not reached ^Z substr outside of string at - line 4. Use of uninitialized value in print at - line 4. Alive! P:\test>c:\perl561\bin\perl5.6.1.exe use strict; use warnings; my $x=""; print substr($x,2,1); # crashes here print "Alive!\n"; # not reached ^Z substr outside of string at - line 4. Use of uninitialized value in print at - line 4. Alive! P:\test>

Which indicates that the execution path is being truncated or short ciruited when the subcall is in place, but no crash, just a silent move to the END{} of the program--which isn't very freindly.

Seems to be a Win32 thing, and one probably worth reporting even though I cannot see how to provide any sort of indication of where the problem might occur?


Examine what is said, not who speaks.
Silence betokens consent.
Love the truth but pardon error.

In reply to Re^5: substr oddity by BrowserUk
in thread Perl oddities by brian_d_foy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others musing on the Monastery: (3)
    As of 2017-11-21 05:30 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      In order to be able to say "I know Perl", you must have:













      Results (295 votes). Check out past polls.

      Notices?