Re: cut and substitute

2004-06-23 Thread John W. Krahn
Amit Virmani wrote: > > Problem: > I have a field $cusip that has to change from ABC123-XX-7 (9 characters with '-') to > ABC123XX (first 8 characters only without '-') > > I have following lines of code: > : > : > $cusip =~ s/\-//g; > $cusip =~/.${8}$/$1/g; > : > : > > Is there a shorter way t

RE: cut and substitute

2004-06-22 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Virmani, Amit (GMI Debt Technology) wrote: > Problem: > I have a field $cusip that has to change from ABC123-XX-7 (9 > characters with '-') to ABC123XX (first 8 characters only without > '-') If the field is truly a constant as you state, then two substr would be just as good: $c

cut and substitute

2004-06-22 Thread Virmani, Amit (GMI Debt Technology)
Problem: I have a field $cusip that has to change from ABC123-XX-7 (9 characters with '-') to ABC123XX (first 8 characters only without '-') I have following lines of code: : : $cusip =~ s/\-//g; $cusip =~/.${8}$/$1/g; : : Is there a shorter way to transform this. - Amit ===