[Israel.pm] simple script question.
Yossi.Itzkovich at ecitele.com
Yossi.Itzkovich at ecitele.com
Sun Sep 26 03:13:13 PDT 2004
Hi,
I didn't check it, but I think that the construct of
while (<STDIN>)
does implicit:
while ($_=<STDIN>)
But you don't get it for free in :
<STDIN>
So make it :
$_=<STDIN>
Yossi
"Prager, Mark"
<Mprager at ndsisra To: <perl at perl.org.il>
el.com> cc:
Sent by: Subject: [Israel.pm] simple script question.
perl-bounces at per
l.org.il
09/26/2004 13:55
Please respond
to Perl in
Israel
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.
***********************************************************************************
_______________________________________________
Perl mailing list
Perl at perl.org.il
http://perl.org.il/mailman/listinfo/perl
More information about the Perl
mailing list