[Israel.pm] simple script question.

Prager, Mark Mprager at ndsisrael.com
Sun Sep 26 03:55:25 PDT 2004


Hi - 
I am trying to get the following short script to work -

#!/usr/local/bin/perl

while (<STDIN>)
{
        chomp;
        if (/PrintThis/) # if the line contains the word Template - prints out this line, and the next;
        {
                print "$_\n";
                <STDIN>;
                print "$_\n";
        }
}

The idea is if I have a file as follows:

PrintThis
aaaaa
bbbbb


PrintThis
nnnnn
ddddd


PrintThis
kkkk
lllll

The output would be:

PrintThis
aaaa

PrintThis
nnnnn

PrintThis
kkkkk

However, All I am getting is:

PrintThis
PrintThis
PrintThis

Can someone please tell me what I am doing wrong ?


Best Regards,

Mark Prager
I & T Engineer, Project Delivery
Binyan Mercazim, Room 514
NDS Technologies Israel Ltd.


5A Hamarpe Street
Har Hotzvim PO BOX 23012
Jerusalem 912235 Israel
Tel:+ 972-2-589-4264
Mob:+ 972-54-566-4264
Fax:+ 972-2-589-4725
Url: http://www2.ozin.com/mark
mailto:mprager at ndsisrael.com 

***********************************************************************************
Information contained in this email message is intended only for use of the individual or entity named above. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the postmaster at nds.com and destroy the original message.
*********************************************************************************** 
***********************************************************************************
Information contained in this email message is intended only for use of the individual or entity named above. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the postmaster at nds.com and destroy the original message.
***********************************************************************************




More information about the Perl mailing list