Anish has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl open (diff, "<SAPPDAY.00063"); open (out, ">SAPPDAY.00063.new"); while (<diff>) { if (/(^16|^88)/) { @words=split(/,/, $_); $field_cnt=$#words ; print " Field count = $field_cnt\n" ; $last_length=length($words[$field_cnt]) ; $num1 =$last_length-1; if ( substr($words[$field_cnt], $num1, 1) eq " " ) { $part1 = substr($words[$field_cnt], 0, -2 ); $part2 = substr($words[$field_cnt], $last_length, 1 + ); $words[$field_cnt] = $part1 . $part2; print out "$words[field_cnt]\n"; } } } ~
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Substring1
by Fastolfe (Vicar) on Oct 02, 2000 at 22:10 UTC | |
|
RE: Substring1
by isotope (Deacon) on Oct 02, 2000 at 21:55 UTC |