El Wednesday 27 August 2008 10:20:50 Anirban Adhikary va escriure: > Dear List > I have a source file as follows > hello how are you? > hello how are you? > What language did you want to use? > What language did you want to use? > I am here > You are there > this is my first perl script > What language did you want to use? > #################################################### > I want to write a script which will take a single line from the filehandel > and print the line without any space between words of that line > I have written a code as follows( I can achieve this by using an array but > I don't want to use an array) > > > use strict; > use warnings; > > my $fname="/home/anadhikary/perl/file1.txt"; > open my $FH,'<',$fname; > while(<$FH>) > { > my ($line)=split(/\s+/,$_); > print $line."\n"; > } > close($FH); > > But this code prints only the first words of every line.... > Where I am making the mistake??? > > Thanks&Regards in advance > Anirban Adhikary.
Just use that: s# +##g; -- Xavier Mas ______________________________________________ LLama Gratis a cualquier PC del Mundo. Llamadas a fijos y m�viles desde 1 c�ntimo por minuto. http://es.voice.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/