Steve Massey wrote: > Hi > > I though I had sussed this s/ stuff but > > #! /usr/bin/perl -w > > $test = "BRIGHTON,,,,,,,,,,,,,,,, (Firm),,,,,,,,,,,,,,,,,,,,,,,,,,,,"; > > print "$test\n"; > $test =~ s/,*/,/; > $test =~ s/,*$/,/g; > > print "$test\n"; > > does not work, I want to substitute all multiple commas into a single one. > > any help appreciated > > Steve
One of these should work: Greetings! E:\d_drive\perlStuff>perl -w $test = "BRIGHTON,,,,,,,,,,,,,,,, (Firm),,,,,,,,,,,,,,,,,,,,,,,,,,,,"; print "$test\n"; $test =~ s/,+/,/g; print "$test\n"; ^Z BRIGHTON,,,,,,,,,,,,,,,, (Firm),,,,,,,,,,,,,,,,,,,,,,,,,,,, BRIGHTON, (Firm), Greetings! E:\d_drive\perlStuff>perl -w $test = "BRIGHTON,,,,,,,,,,,,,,,, (Firm),,,,,,,,,,,,,,,,,,,,,,,,,,,,"; print "$test\n"; $test =~ s/,*/,/g; $test =~ s/,*/BRIGHTON,,,,,,,,,,,,,,,, (Firm),,,,,,,,,,,,,,,,,,,,,,,,,,,, Terminating on signal SIGINT(2) Greetings! E:\d_drive\perlStuff>perl -w $test = "BRIGHTON,,,,,,,,,,,,,,,, (Firm),,,,,,,,,,,,,,,,,,,,,,,,,,,,"; print "$test\n"; $test =~ s/,+/,/g; $test =~ s/,+$//; print "$test\n"; ^Z BRIGHTON,,,,,,,,,,,,,,,, (Firm),,,,,,,,,,,,,,,,,,,,,,,,,,,, BRIGHTON, (Firm) Greetings! E:\d_drive\perlStuff> Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]