If you just want to remove the last occuring '-' character, then the following would work.
s/(.*)-(.*)/$1$2/;
Well, huh. That does work. Though it reminds me only of how little I understand why.
Thanks, you've made it look easy.
His regex works because perl uses greedy regular expression matching. This means that perl matches the longest string possible when you use the first .*. Which means the first .* ($1) matches all the -'s except for the last one.
A bit less confusing regex, IMO, would be
s/(.*)-([^-])/$1$2/;
Which defines the second backreference to be specifially characters that aren't -'s.
-- Ken Simon
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>