Be aware that regular expressions are case sensitive; you are looking for "foo" but the string contains "FOO". Also, you seem to be matching against $_ and applying substr to it but your code doesn't show where you initialise it. I'm finding your question a little difficult to understand but perhaps captures and lc would be applicable.
knoppix@Microknoppix:~$ perl -Mstrict -wE ' > my $var1 = q{some_stuff_FOO}; > my $var2 = q{more_gubbins_BAR}; > my $var3 = q{lose_this_LOST}; > > my $path = join q{/}, > q{}, > map { my( $ext ) = m{([A-Z]+)$}; lc $ext } $var1, $var2, $var3; > say $path;' /foo/bar/lost knoppix@Microknoppix:~$
I hope I've guessed correctly and this is helpful.
Cheers,
JohnGG
In reply to Re: Building Paths without Regex
by johngg
in thread Building Paths without Regex
by rehann
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |