On Mon, 03 Feb 2003 10:29:14 -0500, Paul Kraus wrote: > I have an array that I want to remove every instance of '$' and all > leading and trailing white space. > My code only seems to remove '$'. I know I can split this into separate > commands but is there a way to do this all at once?
Erm, I don't want to be offensive, but to do it in 3 commands is still the best. These are 3 different jobs and your code will be much more maintainable if they aren't munged together! I believe also that it will the quickest _not_ to mix them together. Just write the quick and short solution: tr/$//d, s/^\s+//, s/\s+$// for @fields; Note that the , still enables to write it as one liner. > > $_=~s/($\s+)||(\s+^)||(\$)//g foreach (@fields); > I have also tried > $_=~s/[($\s+)(\s+^)(\$)]//g foreach (@fields); Cheerio, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]