Don't eschew
$^R! That's what it's there for:
# UPDATED: added comments about what's going on
our @rv; # you like taking trips? ;)
m{
(text);
# the (?{ ... }) block's return value
# is given to $^R, the magical variable
# whose value is auto-localized and gets
# rolled back when backtracking occurs.
# $^R's initial value, then, is an array
# ref with one element, $1's value.
(?{ [$1] })
(?:
(float)
# then, four times, we add the float we
# match in $2 to the end of $^R. we
# can't just do push(@{$^R}, $2), because
# that would break the auto-rollback magic,
# so instead, we just let the return value
# set $^R again.
(?{ [ @{$^R}, $2 ] })
non-num
){4}
# finally, we store @{$^R} in @rv.
(?{ @rv = @{$^R} })
}x;
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, details, 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, summary, 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?
See Writeup Formatting Tips and other pages linked from there for more info.