open(NAMES, "names.txt")||die "$!"; ($result = join '', <NAMES>)=~s/\s+/ /g;
+Pete -- [EMAIL PROTECTED] ;;($_='Yw_xUabcdtefgdijktljkotiersjkUzxT yvlkbfdtcierstajogvPruntRshackRJelov')=~ y&/RTUv;wxYz$&/ ~'/;$=();$&&&eval&&print "Walter Valenti" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > #!/usr/bin/perl > #use strict; > open (NAMES, "names.txt")||die "can't open names.txt $!"; > while($lin=<NAMES>){ > push (@list,$lin); > } > $result=join(" ",@list); > > > Bye > > Walter > > > > hi, > > i've read and reread "learning perl"'s explanation of the join > > function but i still can't get join to do what i want. i have a file which > > has one word on each line but some lines have more than one word on a line > > and are seperated by a space. i want to join all the words together so that the > > words are not all on a seperate lines, but following one after the other > > seperated by space. the following is the code i have which for some reason > > adds a space before each word and does not join the words using a space a > > glue. > > ================================================================== > > #!/usr/bin/perl > > #use strict; > > open (NAMES, "names.txt")||die "can't open names.txt $!"; > > @names = <NAMES>; > > foreach $line (@names){ > > $result = join("", @boaz); > > print $result; > > } > > > > ================================================================== > > any help would be greatly appreciated. thanks > > -- > > - josh > > N8MSO > > > > 20A8 2FC6 9099 D215 78F4 D005 B9F3 21C4 300C C25E ~. .~ Tk Open Systems > > =}------------------------------------------------ooO--U--Ooo------------{= > > - [EMAIL PROTECTED] - tel: +972.58.520.636, http://www.tkos.co.il > > > > -- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > _________________________________________________________ > Do You Yahoo!? > Get your free @yahoo.com address at http://mail.yahoo.com > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]