On 7/18/07, Joseph L. Casale <[EMAIL PROTECTED]> wrote:
Interesting,
I see from your regexp you use a \A and \z, from Perldoc this means:
\A      Match only at beginning of string
\z      Match only at end of string

Is "foo10bar" valid?  /^$RE{num}{real}$/ says no, but /$RE{num}{real}/
says yes.  \A and \z are similar to ^ and $, but are not effected by
the m and s flags (which is not an issue in your case since you are
splitting on whitespace).


I am not sure I understand this requirement?

In my case, I am checking an array of 3 scalars. Does this make sense:
next unless @data =~ /$RE {num}{real}/;
Does the regexp know to evaluate each element in the array implicitly?
Or do I need to tell it this?

Not in Perl 5 (Perl 6 will have the smart match operator ~~).  If you
want to bail if any of the values in @data are not numbers then you
should say

next if grep { not /^$RE{num}{real}$/ } @data;

Or if you want to reduce @data to just the numbers

next unless my @num = grep { /^$RE{num}{real}$/ } @data;

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to