[EMAIL PROTECTED] (Juerd) writes:

> Sean O'Rourke skribis 2004-04-19 15:11 (-0700):
>> > I'd hate to give up dividing slash. It's one of the few operators that I
>> > sometimes type without whitespace. Simple because 1/10 is good enough
>> > and 1 / 10 is very wide.
>> You can have both, though.
>
> But not in a way that makes $foo/$bar divide $foo by $bar, if $foo is a
> hashref.

I'm saying "division" is now defined such that when the numerator is
a hash(-ref), the result is the set of values associated with the
denominator.  I've never tried to divide a hash or hashref by
something without it being a bug.

>> > That would mean giving up // for regexes (i.e. making the m
>> > mandatory).
>> Since modifiers have to be up front, and since hash slices won't have
>> a trailing '/', I don't think there's any ambiguity -- anything ending
>> in a '/' is a regex, anything otherwise is a hash slice.
>
> I don't understand. Could you give some examples? Is this in the context
> of bare /path/to/foo, even?

Sure:

    /foo/       # trailing slash -- so it's a regexp (m/foo/)
    /foo\/bar/  # trailing slash -- syntax error (m/foo/ bar/)
    /foo/a      # hash-path -- no trailing slash ($_.{'foo'}{'a'})
    /foo\/bar   # hash-path -- no trailing slash ($_.{'foo/bar'})
    /foo\/      # hash-path -- no trailing slash ($_.{'foo/'})


/s

Reply via email to