[EMAIL PROTECTED] wrote:

[EMAIL PROTECTED] wrote:



Hi All,

The code below does what I want to do, but it takes 3 lines and a


temporary


array (yuck). I can't come up with a one line regex substitution.


Anyone


got one?

my $tmp = reverse split //, $_;
$tmp =~ s/-//;
$_ = reverse split //, $tmp;


can you post a sample string which you want to substitute..



sure.

Example record:
00000-00000-00000-EXAMPLE-000000-621

Will become:
00000-00000-00000-EXAMPLE-000000621

If you just want to remove the last occuring '-' character, then the following would work.

s/(.*)-(.*)/$1$2/;



Reply via email to