How to remove last n number of numeric characters from a string in perl

I have a situation where I need to remove the last n numeric characters after a / character.

For eg:

/iwmout/sourcelayer/iwm_service/iwm_ear_layer/pomoeron.xml@@/main/lsr_int_vnl46a/61

After the last /, I need the number 61 stripped out of the line so that the output is,

/iwmout/sourcelayer/iwm_service/iwm_ear_layer/pomoeron.xml@@/main/lsr_int_vnl46a/

I tried using chop, but it removes only the last character, ie. 1, in the above example.

The last part, ie 61, above can be anything, like 221 or 2 or 100 anything. I need to strip out the last numeric characters after the /. Is it possible in Perl?

5
задан Pradeesh 5 September 2013 в 13:04
поделиться