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/ .. /east/ ; } print "\n"; Thanks Prasannna -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, September 14, 2006 4:57 PM To: beginners@perl.org Subject: extracting line between words Hi Perlers........... 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: #!/usr/bin/perl use warnings; use strict; my @line = "The Sun rises in the east and "; my $store; while(<@line>){ print if $_ =~ /The/ .. /east/ ; } print "\n"; But the output is coming like this TheSunrisesintheeast But I want the output like this The Sun rises in the east So could u plz sugest me where I am wrong........ or where do I need to modify my code............. With warm regards Macky =====-----=====-----===== Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>