Greg Carrara wrote: > > unless (open(INFILE, "accounts.txt")) { > > die ("Cannot open input file accounts.txt.\n"); > } > > unless (open(OUTFILE, ">nospace.txt")) { > > die ("Cannot open output file nospace.txt.\n"); > } > > $line = <INFILE>; > > while ($line ne "") { > > if ($line =~ / +/) { > print OUTFILE ('"'); > print OUTFILE ($line); > print OUTFILE ('"'); > } > else { > print OUTFILE ($line); > } > > $line = <INFILE>; > > } > }
try something like: #!/usr/bin/perl -w use strict; open(INFILE,"accounts.txt") || die $!; open(OUTFILE,">nospace.txt") || die $!; while(<INFILE>){ chomp; s/.* .*/"$_"/; print OUTFILE "$_\n"; } close(INFILE); close(OUTFILE); __END__ david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]