>>>>> "GH" == Gunnar Hjalmarsson <> writes:
>> >> local $/ ;
GH> --^^^^^^^^^^
GH> Shouldn't be there.
>> and why not? i wanted a full file slurp, not a line by line one. it
>> would be faster this way than yours.
GH> Well, since all it results in is:
GH> %buckets = ( A => ['a'] );
GH> it's probably faster.

Maybe it's possible to modify it in some
GH> other way to fulfil your intention, but in that case I think you'd
GH> better show us.
this works with or without the scalar:
local $/ ;
map { push @{$buckets{uc $2}}, $1 while /(([a-z]+)\d*)/g } scalar <> ;
note the horrid use of map in a oid context. i needed something to set
$_ without a full foreach block or whatever. this is an odd case for
wanting multiple statement modifiers but i know p6 won't get them. it
would look too contrived to write that like:
push @{$buckets{uc $2}}, $1 while /(([a-z]+)\d*)/g } for scalar <> ;
here is a shorter one. golf anyone> the names could be shortedn and the
regex is not well defined by the OP (i wrote a simple general alphas
followed by optional digits).
$_ = <> ; push @{$buckets{uc $2}}, $1 while /(([a-z]+)\d*)/g ;
the problem with my untested code was that it was executing <> each time
through the while and i just wanted the regex to execute.
uri
--
Uri Guttman ------
--------
http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ----------------------------
http://jobs.perl.org
Damian Conway Class in Boston - Sept 2003 --
http://www.stemsystems.com/class