Re: extracting line between words

2006-09-14 Thread John W. Krahn
John W. Krahn wrote: > [EMAIL PROTECTED] wrote: >> >>But the output is coming like this TheSunrisesintheeast >> >>But I want the output like this The Sun rises in the east > > my @line = "The Sun rises in > the east and "; > print join ' ', split ' ', $line[ 0 ]; print map { join(

Re: extracting line between words

2006-09-14 Thread John W. Krahn
[EMAIL PROTECTED] wrote: > Hi Perlers... Hello, > I need to extract line between two words > > like > > > @line = "The Sun rises in > the east and "; > > Now I want to extract the line from The word to east > > For tht I am using the following code: > > #!

RE: extracting line between words

2006-09-14 Thread Nagasamudram, Prasanna Kumar
Hi Mayank Please add $\=" "; to your code as follows. $\ is the output field separator. #!/usr/bin/perl use warnings; use strict; my @line = "The Sun rises in the east and "; my $store; $\=" "; ## <- OUTPUT FIELD SEPERATOR## while(<@line>){ print if $_ =~ /The/ ..

Re: extracting line between words

2006-09-14 Thread Igor Sutton
while(<@line>){ print if $_ =~ /The/ .. /east/ ; I suggest this: print join " ", (grep { /The/ .. /east/ } <@line>); -- Igor Sutton Lopes t: +55 51 9627.0779 e: [EMAIL PROTECTED]