in reply to Re^4: How to remove underscore at the end of the line?
in thread How to remove underscore at the end of the line?

It is real hard to believe that when passed the empty string as prefix it would have an underscore at the end of it ya know, your example leaves a whole lot to be desired

This $prefix=~ s/_$//;takes one underscore off the end. To take all underscores off the end you would need $prefix=~ s/_$//g; or $prefix=~ s/_+$//;. But that wasnt what you asked was it? you should have asked how to remove ALL underscores from the end.

Now why might there be more than one underscore at the end of $prefix? well dont you add one when you say ir($prefix . $file .'_', $dir . '/' . $file); and if $file already had one at the end you just made it two didnt you?

so if you dont want an underscore at the end of $prefix then just why do you add one when you call ir()? i would love to hear that explanation.....

another explanation i would like to hear is what good the $$ prototype is doing for you, can you explain why you need it?

and what is going to happen if you ever hit a file with TWO dots in it?

Replies are listed 'Best First'.
Re^6: How to remove underscore at the end of the line?
by Anonymous Monk on Mar 17, 2017 at 07:07 UTC
    Our friend has a problem saying what he means. It seems that the "input" is actually a directory structure containing the path DCMS_DEMO/new_block2/checklist_tmp/rev1, and the "output" is what some file is getting renamed to (not what's printed by any of the random debugging prints). Also, he's run 57 different varieties of his script and he's confused about which runs produced which results.

      i know, just kinda saying "gold knight gray sea"!