Re: Perl clearification

2008-08-07 Thread Anees
On Aug 7, 5:06 pm, [EMAIL PROTECTED] (Rob Dixon) wrote: > Anees wrote: > > Dear friends: > > > I am a perl begineer. I have created an script which prints each 100th > > record from the file as shown below: > > > #!/usr/bin/perl > > $maxRecords=2; > > $steps=100; > > > $index=1; > > $recCounter

Re: Perl clearification

2008-08-07 Thread Rob Dixon
Anees wrote: > Dear friends: > > I am a perl begineer. I have created an script which prints each 100th > record from the file as shown below: > > #!/usr/bin/perl > $maxRecords=2; > $steps=100; > > $index=1; > $recCounter=0; > while (<>){ > if(defined) { > if (($index % $steps) =

Re: Perl clearification

2008-08-07 Thread John W. Krahn
Anees wrote: Dear friends: Hello, I am a perl begineer. I have created an script which prints each 100th record from the file as shown below: #!/usr/bin/perl use warnings; use strict; $maxRecords=2; $steps=100; $index=1; $recCounter=0; while (<>){ That is short for: while ( defin

Re: Perl clearification

2008-08-07 Thread Mr. Shawn H. Corey
On Thu, 2008-08-07 at 18:42 +0800, Jeff Pang wrote: > Anees 写道: > > > > #!/usr/bin/perl > > $maxRecords=2; > > $steps=100; > > > > $index=1; > > $recCounter=0; > > while (<> && defined){ > > > This is not right. > defined is equal to defined($_), but here $_ go without value. > For reading

Re: Perl clearification

2008-08-07 Thread Jeff Pang
Anees 写道: > > #!/usr/bin/perl > $maxRecords=2; > $steps=100; > > $index=1; > $recCounter=0; > while (<> && defined){ This is not right. defined is equal to defined($_), but here $_ go without value. For reading a file line by line, saying: while(<>) { ... } is enough. while(<>) { if