Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

comment on

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

One particular itch that needed scratching, apart from some of the points that TimToady makes, is that it got rid of the ugly state-with-a-my hack that went something like:

my $persist if 0;

That particular construct breaks through the abstraction of the language and hits an oddity in the way lexicals are implemented. The result of which was, when used in a routine, a variable that maintained its previous value next time the routine was called.

It was a sufficiently desirable trick that it was independently discovered time and again, by people who understood the language sufficiently deeply, and tried it out and were happy to discover that it worked.

Unfortunately, it was also regularly discovered by people who had no idea what was going on, and it led to bugs that were difficult to understand and fix (especially when the if 0 was buried under a complex expression).

So one of things that went into 5.10 was the outlawing of my $foo if 0 to stop people shooting themselves in the foot, and the introduction of state variables, for those who needed them.

• another intruder with the mooring in the heart of the Perl

In reply to Re^2: About "state" variables in Perl 5.10 by grinder
in thread About "state" variables in Perl 5.10 by citromatik

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

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (1)
As of 2021-05-14 05:11 GMT
Find Nodes?
    Voting Booth?
    Perl 7 will be out ...

    Results (148 votes). Check out past polls.