On Apr 30, Harry Jackson said:

>#!perl
>#
># These are a must of course.
>use strict;
>use warnings;
>
># Note I am trying to avoid flames 
># by including all the usaul 
># warnings stricts etc
>
># 
>my $CurrentLine;
>
>#
># Please enter your own pathname
>#
>open (INFILE, "c:\\hello.txt") || die "Unable to open file $!";
>
>while ( defined($CurrentLine = <INFILE>)) {

Are you aware that when you do:

  while ($CurrentLine = <INFILE>) { ... }

Perl puts the defined() in for you?

>       print STDOUT "$CurrentLine";

"STDOUT" is unnecessary, as are the quotes.

The while loop could have been:

  while (<INFILE>) { print }

>    };
>
>    close(INFILE);
>
>exit 0;

The exit() is also unnecessary.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to