good chemistry is complicated,and a little bit messy -LW PerlMonks

### Comment on

 Need Help??
With 5.12.2:
```\$ perl -wE 'my \$s = "foo bar"; \$s =~ /(bar)/; say \${^PREMATCH}'
foo
\$ perl -wE 'my \$s = "foo bar"; \$s =~ /bar/; say \${^PREMATCH}'
Use of uninitialized value \$^PREMATCH in say at -e line 1.

\$
Note also the difference in what's going on:
```\$ perl -Mre=debug -wE 'my \$s = "foo bar"; \$s =~ /bar/;'
Compiling REx "bar"
Final program:
1: EXACT <bar> (3)
3: END (0)
anchored "bar" at 0 (checking anchored isall) minlen 3
Guessing start of match in sv for REx "bar" against "foo bar"
Found anchored substr "bar" at offset 4...
Starting position does not contradict /^/m...
Guessed: match at offset 4
Freeing REx: "bar"
\$ perl -Mre=debug -wE 'my \$s = "foo bar"; \$s =~ /(bar)/;'
Compiling REx "(bar)"
Final program:
1: OPEN1 (3)
3:   EXACT <bar> (5)
5: CLOSE1 (7)
7: END (0)
anchored "bar" at 0 (checking anchored) minlen 3
Guessing start of match in sv for REx "(bar)" against "foo bar"
Found anchored substr "bar" at offset 4...
Starting position does not contradict /^/m...
Guessed: match at offset 4
Matching REx "(bar)" against "bar"
4 <foo > <bar>            |  1:OPEN1(3)
4 <foo > <bar>            |  3:EXACT <bar>(5)
7 <foo bar> <>            |  5:CLOSE1(7)
7 <foo bar> <>            |  7:END(0)
Match successful!
Freeing REx: "(bar)"
\$

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.
• 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: & & < < > > [ [ ] ]
• Link using PerlMonks shortcuts! What shortcuts can I use for linking?

Create A New User
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (5)
As of 2018-03-24 08:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
When I think of a mole I think of:

Results (297 votes). Check out past polls.

Notices?