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
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) =
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
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
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