J
Josef Lechner
I have to compare pathnames that use different formats; Windows
(.\foo\bar), UNIX (./foo/bar), and sometimes mixed (.\foo/bar). To my
script, all of those pathnames in parentheses are equivalent. However,
perl's regular expressions do not see it that way. The way I've been
handling this is by first converting to UNIX style then comparing.
This works fine, but it really irks me that this is really no different
from what the /i modifier does, in that the /i modifier just treats
upper and lower case letters as if they're the same. I think it is
reasonable to want to do the same sort of deal with different
characters (i.e. /'s and \'s). So, is there a way to make my own
modifiers? perlre mentions (near the end) that qr// can be overloaded
to make your own escape sequences but I'm not sure if this strategy
would work for me.
(.\foo\bar), UNIX (./foo/bar), and sometimes mixed (.\foo/bar). To my
script, all of those pathnames in parentheses are equivalent. However,
perl's regular expressions do not see it that way. The way I've been
handling this is by first converting to UNIX style then comparing.
This works fine, but it really irks me that this is really no different
from what the /i modifier does, in that the /i modifier just treats
upper and lower case letters as if they're the same. I think it is
reasonable to want to do the same sort of deal with different
characters (i.e. /'s and \'s). So, is there a way to make my own
modifiers? perlre mentions (near the end) that qr// can be overloaded
to make your own escape sequences but I'm not sure if this strategy
would work for me.