in reply to Re: Regex stupidity - or, making the easy things hard
in thread Regex stupidity - or, making the easy things hard

Thoughtfull, and perhaps your solution improves readability. But let's consider your approach:

use strict; use warnings; my $path_info = "/some_module/with/some/args"; my @module_args = split '/+', $path_info; print join(" :: ", @module_args), "\n"; __END__ :: some_module :: with :: some :: args

Note how there is first an empty element in the array, because the PATH_INFO has a leading slash. Then there is the "real first" part which contains the module name and then come the arguments. So in order to make your solution work, you need two shifts to get the module name. I wonder how useful that is but then again, I might be missing something here.

Replies are listed 'Best First'.
Re^3: Regex stupidity - or, making the easy things hard
by JavaFan (Canon) on Oct 10, 2009 at 07:37 UTC
    (undef, my ($module, @args)) = split '/+', $path_info;
    No shifts.