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

Hi finddata
As suggested by davido Please check below it works,
#!/usr/local/bin/perl use strict; use warnings; my $str = 'DCMS_DEMO_new_block2_checklist_tmp_rev1_'; chop $str; print "$str\n"; my $regstr = 'DCMS_DEMO_new_block2_checklist_tmp_rev1_'; $regstr =~ s/_$//; print $regstr;

OUTPUT:
DCMS_DEMO_new_block2_checklist_tmp_rev1
DCMS_DEMO_new_block2_checklist_tmp_rev1

Also for your current input, a chop will also work (which is not recommended if your input line does not have _ always at end.It will remove the last character blindly)
As other monks suggested, please try first and post the code which is not working instead of expecting the full code by other monks here.