Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Hi Perl Monks, I have what is hopefully a simple question, but one I have been unable to search for due to the odd syntax of the below.

The program I'm working on has a core requirement to work on older systems, and has a cutoff of Perl 5.008 (selected because Redhat mid 2000s release was quite late to support 5.010) or newer, though that could change in the future to either a touch earlier version, or a touch later version (but certainly never newer as max oldest than 5.010). As an aside, so far Perl 5.x has far exceeded my wildest expectations in this regard, the program is in fact working on everything! No matter how weird or arcane.

my $a='3.4.4'; my $c = () = $a =~ /\./g; print "$c\n"

However, my question is this: when did Perl begin supporting this type of structure?

$c = () = $a =~ /\./g

I've come across this several times, and I'm allured by it, it calls to me, but I have to be careful using structures that could trigger warnings or failures in old systems.

I'd actually like to significantly expand my use of this type of structure, so besides this specific example, can anyone point me to the right search terms that describe it, that's multiple assignments of some value generated on the right side of the items? And also I believe various items that could be in the second position, (), though I'm not positive about that. And has this support been consistent since version 5.xxx? Are there various types of this assignment that have been introduced earlier or later?

I have the big Larry Walls Perl book, but I don't know what this is called to begin learning more about it, and what variants will be safe to use.


In reply to Syntax Perl Version support $c = () = $a =~ /\./g by h2

Title:
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 How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-19 06:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found