in reply to Regex stupidity - or, making the easy things hard
When I read this, I thought the posting was about the fact that the above is valid code, but the regexp is very unlikely to match a typical PATH_INFO (note that the above code that the terminating regexp delimiter as the last character of the comment!).(my $module) = $ENV{PATH_INFO} =~ m!^/([^/]+)/; # mind this regex, I'm coming back at it in a few secs!
I would have written it as:my @module_args = $ENV{PATH_INFO} =~ m!/([^/]+)!g;
my @module_args = split '/+', $ENV{PATH_INFO};
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regex stupidity - or, making the easy things hard
by muba (Priest) on Oct 10, 2009 at 02:26 UTC | |
by JavaFan (Canon) on Oct 10, 2009 at 07:37 UTC |