skaller wrote:
(snipped more substantial notes on Felix syntax and parsing...)
> Perl actually has
>
> pat ~= arg
>
> for a match .. interesting. (Hmm or is it arg ~= pat .. ?)
>
>
It's arg ~= /pattern/, and in the right context yields a list of
the parenthesized submatches, e.g.,
(my $first, my $last) = ("James Dennett"~= /(\w+)\s+(\w+)/);
will set $first eq "James" and $last eq "Dennett". The longer
form of this is to name the match operator (m): more explicitly,
it's
arg ~= m/pattern/
though in this form it's valid to use quoting characters other
than slashes (which is handy for the common case in which
you want to use slashes in your pattern).
Perl also has other operators that can be used like this: s (for
pattern based substitution), tr (for character-wise translation),
and maybe others I can't remember. They can all also be used
to apply to a default argument ($_) if the ~= form isn't used;
it took me a fair while to get used to the Perl idiom of having
the argument to many functions be implicit (and global and
writable).
-- James
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language