Help for this page

Select Code to Download


  1. or download this
    system(q{cat text.txt|wc -l| sed 's/^[ \t]*//'|sed 's/[ \t]*$//'});
    
  2. or download this
    open my $INPUTFILE, '<', 'text.txt' or die "Can't open file!  $!";
    
  3. or download this
    my $line_count=0;
    while (<$INPUTFILE>) { # read a line
        ++$line_count;     # increment counter
    }
    
  4. or download this
    close $INPUTFILE or die "close error: $!";